Available on all Portkey plans.
Why Responses API
The Responses API is becoming the standard for agentic AI:- Agentic loops β Models emit tool calls, receive results, and continue autonomously
- Items as atomic units β Clear state machines for context management
- Semantic streaming β Predictable, provider-agnostic streaming events
- Unified tool calling β Consistent function calling interface across all providers
Quick Start
Send a Responses API request to any provider. Change themodel string β the API format stays the same.
The same code works for any provider. Switch the
@provider/model string to use OpenAI, Gemini, Groq, Bedrock, or any of the 3000+ supported models. See Model Catalog for setup.Using the OpenAI SDK
The Portkey SDK is a superset of the OpenAI SDK, soportkey.responses.create() works identically. The OpenAI SDK also works directly with Portkeyβs base URL:
Text Generation
Instructions (System Prompt)
Set a system prompt withinstructions or pass a system role message in the input array. Both work identically.
Streaming
Enable streaming withstream: true.
response.created, response.output_text.delta, response.completed, etc.) regardless of the underlying provider.
Multi-turn Conversations
Pass previous messages in theinput array for multi-turn conversations. Two formats are supported:
user, assistant, developer (maps to system), system, and tool.
Generation Parameters
Control generation behavior with optional parameters:Tool Calling
Define tools with the Responses APIfunction tool format. Works across all providers that support function calling.
Tool Choice
Control tool usage withtool_choice:
Python
Function Call Results
Return function call results in a multi-turn flow withfunction_call and function_call_output items:
Input Types
Vision
Send images with theinput_image content type. The optional detail parameter ("high", "low", "auto") controls processing fidelity.
File Inputs
Send files with theinput_file content type. Pass file data as a base64-encoded data URL or reference an existing file by file_id.
Structured Output
Control output format withtext.format. Supports json_schema for strict structured output and json_object for free-form JSON.
JSON Schema
JSON Object
For free-form JSON output without a strict schema:Reasoning and Thinking
Control reasoning with the unifiedreasoning parameter. Portkey maps this to each providerβs native thinking mechanism automatically.
Reasoning Effort
reasoning.effort controls how much the model reasons before responding. Works across OpenAI, Anthropic, and Gemini β Portkey translates to each providerβs native format.
reasoning.effort to each providerβs native thinking configuration:
Anthropic β maps to thinking.budget_tokens
Anthropic β maps to thinking.budget_tokens
Gemini 2.5 β maps to thinking_config.thinking_budget
Gemini 2.5 β maps to thinking_config.thinking_budget
OpenAI o-series
OpenAI o-series
Passed through as
reasoning_effort natively. No translation needed.Anthropic Extended Thinking
For fine-grained control over Anthropicβs extended thinking, pass thethinking parameter directly with an exact budget_tokens value. This takes precedence over reasoning.effort if both are set.
Prompt Caching
Enable prompt caching withcache_control on content items and tools. Works with Anthropic and other compatible providers.
Python
Using with Portkey Features
The Responses API works with all Portkey gateway features.Configs
Route, load balance, and set fallbacks
Caching
Cache responses for faster, cheaper calls
Guardrails
Input/output guardrails
Observability
Full logging and tracing
Provider Support
Portkey handles the Responses API in two ways depending on the provider:- Native providers β Requests pass through directly to the providerβs Responses API endpoint
- Adapter providers β Portkey automatically translates between Responses API and Chat Completions formats
Native-Only Features
A few features require server-side state and are limited to native providers:previous_response_idβ Use multi-turn conversations to pass history in theinputarray insteadstoreβ Silently ignored on adapter providers; responses are not persisted server-side- Retrieve / Delete β
GETandDELETEon/v1/responses/:idare not available - Built-in tools β
web_search,file_search,computer_useare native-only. Use Remote MCP or custom function tools instead
Reference
Supported Parameters
Complete list of parameters supported by the Responses API and how they map internally:Input Content Types
Input Content Types
Response Output Types
Response Output Types
API Endpoints
- Create a Response β
POST /v1/responses - Retrieve a Response β
GET /v1/responses/{response_id} - Delete a Response β
DELETE /v1/responses/{response_id} - List Input Items β
GET /v1/responses/{response_id}/input_items
Open Responses Spec
Full specification
API Reference
Responses API reference
Remote MCP
MCP via Responses API
Universal API
All three API formats
Messages API
Anthropic Messages format
Chat Completions
OpenAI Chat Completions format

