https://api.deepinfra.com/v1/openai/responses, so an OpenAI client whose base_url is https://api.deepinfra.com/v1/openai needs no other change.
The API is stateless: DeepInfra does not store responses. Send the conversation so far with every request, as shown in Conversations.
previous_response_id, conversation and background are not supported.Example
response object. output is a list of typed items: message, function_call and reasoning.
Conversations
To continue a conversation, send the earlier turns again. Append theoutput items of the previous response to your input, then add the new message:
store is accepted, and every response reports store: false. GET and DELETE /v1/responses/{id} return 404.
Function calling
Tools use the Responses shape:name, description and parameters sit at the top level of the tool, not under a function key as in Chat Completions.
function_call_output.output is a string, or an array of input_text and input_image parts. An image part needs a vision model.
Only function tools are supported. See Tool Calling for more on tools.
Structured outputs
Settext.format to json_object, or to json_schema with a schema to enforce:
Reasoning
reasoning.effort takes the same values as reasoning_effort on Chat Completions; see Reasoning Models. The reasoning comes back as a reasoning item ahead of the message, with the text in content:
summary is empty and no encrypted_content is returned. reasoning.summary and include: ["reasoning.encrypted_content"] are accepted and ignored. Keep reasoning items in the output you replay on the next turn: they are accepted as input.
Images
On a vision model, addinput_image parts to a user message. image_url is an HTTPS URL or a data: URL; file_id is not supported.
Streaming
Setstream to true to receive typed server-sent events:
A response that stops at
max_output_tokens ends with response.incomplete and incomplete_details.reason.
Supported parameters
These fields are rejected with a 400, so a request never runs with part of it silently dropped:
previous_response_id,conversation,backgroundmax_tool_calls,truncation: "auto",prompt,text.verbositytop_logprobsandinclude: ["message.output_text.logprobs"]input_fileparts, andinput_imagewith afile_id- Hosted tools:
file_search,code_interpreter,mcp,computer_use
web_search tool is ignored when the model can’t serve it, because Codex attaches one to every request.
For the full request and response schema, see the API reference.
Errors
Errors use the OpenAI error object. A prompt that does not fit the model’s context window fails with the codecontext_length_exceeded: as an HTTP 400 on a non-streaming request, and as a response.failed event on a streaming one.
OpenAI Agents SDK
The OpenAI Agents SDK uses the Responses API by default. Give it a client that points at DeepInfra:Runner.run_streamed and client-side sessions such as SQLiteSession work. The SDK’s hosted tools (FileSearchTool, CodeInterpreterTool, HostedMCPTool) run on OpenAI’s servers, and previous_response_id and conversation_id need stored responses, so those return a 400.
Codex CLI
Codex CLI talks to any Responses endpoint. Add DeepInfra as a model provider in~/.codex/config.toml:
model_context_window with its context size in tokens, listed on each model page, so Codex compacts the conversation in time. Codex caps this setting at 272K for models it does not know, so leave it out for a 1M model.
If a request still does not fit, Codex stops the turn and reports that the context window is full. Run /compact to summarize the conversation, then continue.