curl --request POST \
--url https://api.example.com/v1/responses \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"instructions": "<string>",
"messages": [
{}
],
"tools": [
{}
],
"tool_choice": {},
"parallel_tool_calls": true,
"reasoning": {},
"text": {},
"stream": true,
"include": [
{}
],
"conversation": "<string>",
"previous_response_id": "<string>",
"store": true,
"truncation": "<string>",
"prompt_cache_key": "<string>"
}
'{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"output": [
{}
],
"usage": {},
"error": {},
"response.created": {},
"response.in_progress": {},
"response.output_text.delta": {},
"response.refusal.delta": {},
"response.function_call.delta": {},
"response.completed": {},
"response.incomplete": {},
"response.failed": {}
}Create a response using OpenAI Responses API format
curl --request POST \
--url https://api.example.com/v1/responses \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"instructions": "<string>",
"messages": [
{}
],
"tools": [
{}
],
"tool_choice": {},
"parallel_tool_calls": true,
"reasoning": {},
"text": {},
"stream": true,
"include": [
{}
],
"conversation": "<string>",
"previous_response_id": "<string>",
"store": true,
"truncation": "<string>",
"prompt_cache_key": "<string>"
}
'{
"id": "<string>",
"object": "<string>",
"status": "<string>",
"output": [
{}
],
"usage": {},
"error": {},
"response.created": {},
"response.in_progress": {},
"response.output_text.delta": {},
"response.refusal.delta": {},
"response.function_call.delta": {},
"response.completed": {},
"response.incomplete": {},
"response.failed": {}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Soju06/codex-lb/llms.txt
Use this file to discover all available pages before exploring further.
/v1/responses endpoint provides OpenAI Responses API compatibility. It accepts structured input with instructions and forwards requests to upstream with proper validation, sanitization, and error handling.
This endpoint supports both streaming and non-streaming modes, handles conversation context, and provides full tool calling capabilities.
Bearer YOUR_API_KEY/v1/models endpoint.Example: "gpt-4.1", "gpt-5.2"input_text item)role (string): "user", "assistant", or "tool"content (string | array): Message contenttype (string): Item type (e.g., "input_text", "input_image", "function_call_output")input_file.file_id is not supported and will return error.input. Array of chat-formatted messages.Cannot be used together with input. Provide either input or messages, not both.Messages are coerced into instructions (for system/developer) and input items (for user/assistant/tool).type (string): Tool typename (string): Tool name (for function tools)description (string): Tool descriptionparameters (object): JSON Schema for parametersfunction: Custom function callsweb_search or web_search_preview: Web search capabilityfile_search, code_interpreter, computer_use, computer_use_preview, image_generation"none": Model will not call tools"auto": Model decides whether to call tools"required": Model must call at least one tool{"type": "...", "name": "..."}effort (string): Reasoning effort level (e.g., "low", "medium", "high")summary (string): Reasoning summary modeverbosity (string): Output verbosity levelformat (object): Output format specification
type (string): "text", "json_object", or "json_schema"schema (object): JSON Schema (for json_schema type)name (string): Schema namestrict (boolean): Strict schema adherencetrue: Returns text/event-stream with Responses eventsfalse: Returns a single response object"code_interpreter_call.outputs""computer_call_output.output.image_url""file_search_call.results""message.input_image.image_url""message.output_text.logprobs""reasoning.encrypted_content""web_search_call.action.sources"400 error.previous_response_id.400 error.Use conversation instead for multi-turn context.false or omitted. Setting to true returns 400 error.400 error if provided.stream is false or omitted, returns a response object:
"response"."completed": Successfully completed"incomplete": Incomplete (e.g., max tokens reached)"failed": Failed with errortype (string): Output type (e.g., "message", "function_call", "web_search_call")input_tokens (integer): Tokens in the inputoutput_tokens (integer): Tokens in the outputtotal_tokens (integer): Total tokens usedinput_tokens_details (object | null):
cached_tokens (integer): Cached input tokensoutput_tokens_details (object | null):
reasoning_tokens (integer): Tokens used for reasoningstatus is "failed").Properties:message (string): Error messagetype (string): Error typecode (string): Error codestream is true, returns text/event-stream with event objects:
response object with id and initial metadata.response data.delta (string): Text fragmentdelta (string): Refusal fragmentcall_id (string): Tool call IDname (string): Tool namearguments (string): Arguments fragmentresponse object with output and usage.response with incomplete_details:reason (string): Why incomplete (e.g., "max_output_tokens", "content_filter")response with error object.error object with error details.curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "Explain quantum entanglement in simple terms"
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "Write a short story about a robot",
"stream": true
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"instructions": "You are a helpful coding assistant. Provide concise answers with code examples.",
"input": "How do I sort a list in Python?"
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [
{"role": "system", "content": "You are a math tutor."},
{"role": "user", "content": "What is 15 * 23?"}
]
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "What is the current time in Tokyo?",
"tools": [
{
"type": "function",
"name": "get_time",
"description": "Get current time for a timezone",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "IANA timezone name"
}
},
"required": ["timezone"]
}
}
],
"tool_choice": "auto"
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "What are the latest developments in fusion energy?",
"tools": [
{"type": "web_search"}
]
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.2",
"input": "Solve this complex math problem: ...",
"reasoning": {
"effort": "high",
"summary": "concise"
}
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "List 3 programming languages with their use cases",
"text": {
"format": {
"type": "json_schema",
"name": "languages",
"schema": {
"type": "object",
"properties": {
"languages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {"type": "string"},
"use_case": {"type": "string"}
},
"required": ["name", "use_case"]
}
}
}
},
"strict": true
}
}
}'
curl https://api.example.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"input": "Tell me more about that",
"conversation": "conv_abc123"
}'
reasoning_contentreasoning_detailstool_calls (in input context)function_call (in input context)reasoning controls are preserved.
output_text typefunction_call_output format with call_idsafety_identifierprompt_cache_retentiontemperaturemax_output_tokens{
"error": {
"message": "Error description",
"type": "invalid_request_error",
"code": "error_code",
"param": "field_name"
}
}
invalid_request_error: Invalid request parametersmodel_not_allowed: API key lacks access to requested modelno_accounts: No upstream accounts available (503 status)upstream_error: Upstream service error (502 status)not_implemented: Feature not implemented (501 status)response.failed or error events.
input or messages required (not both)input must be string or arrayinput_file.file_id is rejectedweb_search_preview normalized to web_searchfile_search, code_interpreter, computer_use, image_generationconversation and previous_response_idprevious_response_id is not supportedstore must be false or omittedtrue returns errortruncation is not supportedallowed_models configured, only those models can be used. Requests for other models return:
{
"error": {
"message": "This API key does not have access to model 'gpt-5.2'",
"type": "invalid_request_error",
"code": "model_not_allowed"
}
}
/v1/models.