Overview
The Codex responses endpoints provide access to AI models through Codex-LB’s load balancing and account pooling infrastructure. These endpoints support both streaming and compact (non-streaming) response formats.Endpoints
POST /backend-api/codex/responses
Creates a streaming AI response using Server-Sent Events (SSE). Base URL:https://your-codex-lb-instance.com
Request Body
The model ID to use for the request (e.g.,
gpt-5.1, gpt-4o)System-level instructions or prompt for the model
User input as a string or array of message objects
Array of tool definitions for function calling
Controls which tool the model should use (
auto, none, or specific tool)Whether to enable parallel tool calls
Reasoning configuration with
effort and summary optionsText output controls
Whether to stream the response
Additional fields to include in the response. Allowed values:
code_interpreter_call.outputscomputer_call_output.output.image_urlfile_search_call.resultsmessage.input_image.image_urlmessage.output_text.logprobsreasoning.encrypted_contentweb_search_call.action.sources
Conversation ID for multi-turn conversations
Optional cache key for prompt caching
Response
Returns a Server-Sent Events (SSE) stream with events:Example Request
POST /backend-api/codex/responses/compact
Creates a non-streaming AI response that returns a complete response object. Base URL:https://your-codex-lb-instance.com
Request Body
The model ID to use for the request
System-level instructions for the model
User input as a string or array of message objects
Response
Returns a complete response object:Example Request
Reasoning Effort Parameter
Thereasoning.effort parameter controls the depth of reasoning for models that support it:
low- Fast, minimal reasoningmedium- Balanced reasoning and speed (default)high- Maximum reasoning depth
Error Handling
Error object returned when the request fails
Common Error Codes
no_accounts- No available accounts in the poolrate_limit_exceeded- Rate limit reached for your API keymodel_not_found- Requested model is not availableinvalid_request_error- Invalid request parametersupstream_error- Error from upstream AI provider
Notes
- The
/backend-api/codex/responsesendpoint always returns streaming responses - Use
/backend-api/codex/responses/compactfor simple, non-streaming responses - Both endpoints support the same authentication mechanism
- Streaming responses use the Server-Sent Events (SSE) protocol
- The
storeparameter is not supported and must befalse - The
previous_response_idparameter is not supported - Unsupported tool types:
file_search,code_interpreter,computer_use,image_generation