Providers and frameworks
Provider shortcuts
Section titled “Provider shortcuts”| Call | Native object | Default gateway root | Extra |
|---|---|---|---|
shield.openai() | openai.OpenAI | /openai | openai |
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 |
Optional 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.
Every builder accepts provider-specific keyword arguments. SDK-owned defaults
are applied with kwargs.pop, so explicit base_url, key, client, or headers
usually override the generated value. An override can bypass gateway routing or
SDK request hooks; review it as a security-sensitive configuration change.
Provider prompt caching
Section titled “Provider prompt caching”The default OpenAI and Anthropic shortcuts attach an httpx request hook:
- OpenAI receives a stable
prompt_cache_keyderived from the reusable prefix. - Anthropic receives ephemeral cache-control markers on supported static prompt sections.
Passing your own http_client disables that SDK injection. The gateway’s
workspace setting remains authoritative and can strip caching markers.
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("gpt-4o-mini")embedder = shield.bind("langgraph").embedder("text-embedding-3-small")crew_llm = shield.bind("crewai").llm("gpt-4o-mini")agents_client = shield.bind("openai_agents").apply()llama_llm = shield.bind("llamaindex").llm("gpt-4o-mini")autogen_client = shield.bind("autogen").model_client("gpt-4o-mini")pydantic_model = shield.bind("pydanticai").model("gpt-4o-mini")| Canonical binder | Aliases | Builders |
|---|---|---|
langgraph | langchain | model, embedder |
crewai | — | llm, model |
openai_agents | openai-agents | client, apply |
llamaindex | llama-index, llama_index | llm, embedder |
autogen | ag2 | model_client, client |
pydanticai | pydantic-ai, pydantic_ai | model, agent |
Unknown binders raise ValueError; a nonexistent builder attribute raises
AttributeError and lists that module’s callable binders.
Convenience binder accessors exist for shield.crewai(),
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.5.1; 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.
See the provider-specific integration guides and Agentic governance.