Providers and frameworks
Using GPT-6 Astra? Follow Astra with Responses for endpoint, request, output, and MCP filter examples. Changing only model in a Chat Completions example is insufficient when function tools are present, including schemas injected by the gateway. Astra does not support reasoning effort none.
Primary inference
Section titled “Primary inference”Use shield.openai() or shield.async_openai() for the gateway’s common
inference surface, with provider/model-id on each request. Its 29 provider
identities expose different operations and model capabilities. The native SDK
owns serialization, responses, retries, and streams. shield.openai_config()
returns connection settings when application code constructs the native client.
These 2.8.3 APIs are covered by the
all-provider design.
The gateway holds provider credentials and translates protocols. A model must support the selected operation; an audio or video model does not become a chat model by using this client. Keep LangChain, LangGraph, and other frameworks as the orchestration layer, using the model binders below.
Client and framework shortcuts
Section titled “Client and framework shortcuts”| Call | Native object | Default gateway root | Extra |
|---|---|---|---|
shield.openai() | openai.OpenAI | /openai | Included in core |
shield.async_openai() | openai.AsyncOpenAI | /openai | Included in core |
shield.anthropic() | anthropic.Anthropic | /anthropic | anthropic |
shield.bedrock() | boto3 bedrock-runtime client | /bedrock | bedrock |
shield.genai() | google.genai.Client | /genai | genai |
shield.genai_cached() | GenaiCachedClient proxy | /genai | genai |
shield.langchain() | langchain_openai.ChatOpenAI | /langchain | langchain |
shield.litellm() | LiteLLMShield | /litellm | litellm |
shield.pydanticai() | pydantic_ai.Agent | /pydanticai/v1 | pydanticai |
OpenAI is a core dependency; its openai extra is a retained installation alias.
Other integration dependencies are imported lazily. A missing extra raises ImportError
when its builder is called, not when deepintshield is imported. That native
exception carries a stable provider/framework dependency code; use the
error catalog rather than parsing its install message.
Builders accept native keyword arguments, with the supported override names depending on the integration. Explicit connection options override generated defaults and explicit headers merge with gateway headers. A caller-supplied native client owns its own connection; configure its gateway destination and credentials before passing it to a binder.
Provider prompt caching
Section titled “Provider prompt caching”The default OpenAI sync/async and Anthropic shortcuts attach transport request hooks where the installed transport exposes them:
- OpenAI models receive a stable
prompt_cache_keyderived from the reusable prefix; other provider-prefixed models do not receive OpenAI-only cache fields. - Anthropic receives ephemeral cache-control markers on supported static prompt sections.
Passing your own http_client disables that SDK prompt-cache injection.
openai_config() returns connection options and does not install hooks. The
gateway’s workspace setting remains authoritative and can strip caching markers.
The Anthropic shortcut builds its default transport using the installed
Anthropic SDK’s DefaultHttpxClient, so both its httpx and httpx2 transport
generations retain prompt-cache and gateway-header handling. If you supply a
custom transport, use one accepted by your installed Anthropic SDK. Header
normalization still applies to an accepted custom transport.
genai_cached() is opt-in because Gemini context-cache storage is metered. It
hashes the model/system/tools prefix, reuses a live cached-content resource, and
creates a missing resource in the background for a later call. Defaults are a
32,768-token minimum prefix and an environment/configured TTL. Verify economics
with your provider pricing, hit rate, prefix size, and request interval; caching
is not inherently cheaper for every workload.
Passthrough
Section titled “Passthrough”openai = shield.openai(passthrough=True)anthropic = shield.anthropic(passthrough=True)genai = shield.genai(passthrough=True)Passthrough keeps the provider-native wire shape while traversing the corresponding gateway passthrough route. It is not a bypass around virtual-key authentication or every gateway policy. Verify feature behavior on the chosen route; protocol-specific features can differ from the unified route.
Framework binders
Section titled “Framework binders”bind() returns native framework objects pointed at the OpenAI-compatible
gateway transport:
chat_model = shield.bind("langgraph").model("anthropic/claude-sonnet-4-5")embedder = shield.bind("langgraph").embedder("openai/text-embedding-3-small")agents_model = shield.bind("openai_agents").model( "openai/gpt-4o-mini", api="responses")llama_llm = shield.bind("llamaindex").llm("openai/gpt-4o-mini")autogen_client = shield.bind("autogen").model_client("openai/gpt-4o-mini")pydantic_model = shield.bind("pydanticai").model("openai/gpt-4o-mini")strands_model = shield.bind("strands").model("openai/gpt-4o-mini")adk_model = shield.bind("google_adk").model("openai/gpt-4o-mini")These are independent choices; install and use the binder for your framework. Model IDs, including nested deployment and fine-tuned IDs, are passed through to the gateway. The binder does not discover or replace models.
| Canonical binder | Aliases | Builders |
|---|---|---|
langgraph | langchain | model, embedder |
openai_agents | openai-agents | client, model, apply |
llamaindex | llama-index, llama_index | llm, embedder |
autogen | ag2 | model_client, client |
pydanticai | pydantic-ai, pydantic_ai | model, agent |
strands | — | model |
google_adk | google-adk, adk | model |
Unknown binders raise ValueError; a nonexistent builder attribute raises
AttributeError and lists that module’s callable binders.
OpenAI Agents also provides model(model_id, api="responses") or
api="chat_completions"; PydanticAI’s model accepts the same API selector.
Both default to Chat Completions. Choose the API supported by that model and
your tool flow. LlamaIndex uses OpenAILike, and
Strands uses its native OpenAI model. Google ADK uses its public LiteLlm
adapter with explicit OpenAI-compatible routing. Temporal calls the native async
client inside an activity; inference does not belong in deterministic workflow
code. These binders do not change graph or task execution ownership.
For OpenAI Agents, apply(api="responses") configures the SDK’s global default
client and API; model(...) keeps selection local to that model object.
apply() returns the native async client, which must be closed at shutdown.
OpenAI Agents and PydanticAI model binders accept openai_client= to reuse an
application-owned AsyncOpenAI. For the PydanticAI agent builder, pass the API
selector in model_kwargs={"api": "responses"}.
Model capabilities remain explicit:
- LlamaIndex: set
context_windowandis_function_calling_modelfrom the chosen model’s actual capabilities.OpenAILikeavoids a fixed OpenAI-only model catalog but does not discover those values. - AutoGen: when its catalog does not recognize the ID and requests
model_info, the binder supplies conservative text-only capabilities. Provide verifiedmodel_infoto enable tools, vision, or structured output. - LangChain/LangGraph embeddings: the binder defaults
check_embedding_ctx_length=Falseso non-OpenAI providers receive text, rather than OpenAI tokenizer IDs. Manage model input limits in your pipeline. - Strands: pass inference settings in
paramsand connection settings inclient_args. A supplied nativeclientremains caller-owned. - Google ADK: pass the gateway model ID directly. The binder adds the outer
openai/transport prefix used by LiteLLM and preserves the full gateway ID.
Convenience binder accessors exist for shield.openai_agents(),
shield.llamaindex(), and shield.autogen().
Transparent routing versus Agentic enforcement
Section titled “Transparent routing versus Agentic enforcement”A binder changes where model/embedding traffic is sent and adds gateway
attribution headers. Agentic framework enforcement is a separate layer installed
by the live DeepintShield client. You can use either layer independently, but
most governed agents need both:
native model / embedder -> DeepIntShield gateway -> providernative tool boundary -> Agentic decision -> local or MCP toolUse identity=True on a binder only when the gateway route should also receive
an agent token. This can trigger identity discovery and token acquisition.
Compatibility and verification
Section titled “Compatibility and verification”The tables above describe builders present in SDK 2.8.3; they do not guarantee every version or feature of each third-party package. Pin and test the provider and framework versions used in production. Cover basic calls, streaming, structured output, tool calls, embeddings, errors, timeouts, and shutdown. Automatic Agentic integration fails closed when an imported framework version cannot be instrumented, rather than silently claiming protection.
Dependency combinations
Section titled “Dependency combinations”Earlier SDK 2.8.0 installation checks used these separate Python 3.13
environments, each with a passing pip check. These historical compatibility
snapshots do not guarantee future upstream releases:
| Extras installed together | Checked native package versions |
|---|---|
llamaindex,langchain,langgraph | OpenAI 2.54.0; LlamaIndex OpenAI-like LLM 0.8.0 / embeddings 0.4.0; LangChain OpenAI 1.6.1; LangGraph 1.2.11 |
pydanticai,openai-agents,autogen,langchain,langgraph | OpenAI 3.10.0; PydanticAI slim 2.41.0; OpenAI Agents 0.22.1; AutoGen 0.7.5; LangChain OpenAI 1.6.1; LangGraph 1.2.11 |
strands,google-adk,temporal | OpenAI 2.54.0; Strands 1.55.0; Google ADK 1.39.1; LiteLLM 1.100.0; Temporal 1.32.0 |
For example, install one combination in its own environment:
python -m venv .venvsource .venv/bin/activatepip install "deepintshield[llamaindex,langchain,langgraph]==2.8.3"pip checkLock resolved versions for reproducibility. In these combinations,
the LlamaIndex OpenAI adapter constrains OpenAI below 3; PydanticAI and OpenAI Agents
versions require OpenAI 3.
The compatible all aggregate uses OpenAI 2, OpenAI Agents
0.20.x, PydanticAI slim 2.31.x and the OpenAI-specific LlamaIndex packages.
On Python 3.14, the aggregate selects Google ADK 1.35.x and Google API Core
2.25.x so the Google dependencies can share AutoGen’s protobuf 5 requirement.
Individual extras retain their newer framework requirements. Mixing those
extras with all can introduce incompatible versions.
python -m pip install --upgrade "deepintshield[all]==2.8.3"python -m pip checkThe explicit SDK version prevents pip from selecting an older SDK to satisfy dependency conflicts. Install only the extras needed by your application when you want to use a newer framework release.
See the provider-specific integration guides and Agentic governance.
Optional native provider features
Section titled “Optional native provider features”After validating the primary client and orchestration path, use the Anthropic, Bedrock, or Google native shortcut for a feature that needs its native protocol. Install only that optional dependency and use its documented gateway route. These retained shortcuts are not 29 separately maintained native SDK wrappers. Native passthrough retains virtual-key authorization and its own documented policy/operation coverage. New upstream features still require gateway support.
For Google GenAI text-only calls, the examples set
config={"automatic_function_calling": {"disable": True}} when there are no
Python tools to execute. For callable tools, use the native
genai.chats.create(..., config={"tools": [tool]}) and send_message /
send_message_stream flow. Native async interfaces remain under genai.aio.
The gateway conversion preserves tool roles, per-call thought signatures, and
distinct IDs for parallel function calls. Validate the complete continuation
flow for your selected model; a text-only response does not test tool execution.
SDK 2.8.3 retains the gateway destination and guarded headers when a Google
http_options override changes only timeout. Prompt/context cache behavior and
provider-native protocol support still depend on the configured gateway route.