Installation
DEEPINFRA_TOKEN.
Configuration
Create the Chat Completions client with DeepInfra’s base URL and your API key, then build an agent from it. Everything else works as described in the Agent Framework docs.response_format with json_schema and strict: true is supported on many models; see Structured Outputs.
To pick a model, list the catalog with context windows and pricing via
/v1/openai/models?filter=with_meta&sort_by=maf. Each entry’s metadata block has context_length, max_tokens, and per-million-token pricing; the id is what you pass as model.Environment variables
The Python clients fall back toOPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_CHAT_COMPLETION_MODEL when constructor arguments are omitted, so you can also configure them that way:
If a real OpenAI key is already set in
OPENAI_API_KEY, the client will send it to DeepInfra. Passing api_key and base_url explicitly, as above, avoids that.Embeddings
OpenAIEmbeddingClient takes the same arguments. Use any embedding model from the catalog.
Reasoning models
DeepInfra returns the chain-of-thought of reasoning models in areasoning_content field, in both the final message and each streaming delta. Agent Framework does not read that field natively, but its response_parser hook lets you surface it as text_reasoning content. Set reasoning_effort through options; any key there is forwarded to the OpenAI SDK, and DeepInfra-only parameters can go in options={"extra_body": {...}}.
message_preparer is needed; sessions and tool-call loops work with this parser as-is.
Learn more
Agent Framework docs
Agents, tools, sessions, structured output, workflows, and observability.
OpenAI-compatible endpoints
Agent Framework’s guidance on adapting its OpenAI client to other providers.
Agent Framework is under active development and API names change between releases; see the Python changelog. Tested with
agent-framework-openai 1.14.2, openai 3.11.0, and Microsoft.Agents.AI.OpenAI 1.20.0.