Serve API reference
Responses
POST /v1/responses, the OpenAI API Codex CLI uses. Input items, function and custom tools, previous_response_id and the full event stream.
POST http://127.0.0.1:8080/v1/responses, the API Codex CLI uses. Same model, tool calling and limits as Chat Completions.
curl http://127.0.0.1:8080/v1/responses -H 'content-type: application/json' -d '{ "model": "pooled", "instructions": "Answer in one sentence.", "input": "What is a KV cache?"}'from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8080/v1", api_key="pooled")r = client.responses.create(model="pooled", input="What is a KV cache?")print(r.output_text)
# Continue from the stored responser2 = client.responses.create(model="pooled", previous_response_id=r.id, input="Shorter.")print(r2.output_text)input is a string or a list of items:
- messages with role
user,assistant,systemordeveloper function_callandfunction_call_outputcustom_tool_callandcustom_tool_call_outputreasoning: whenencrypted_contentholds apooled1.value from this bridge, the room gets back its exact reasoningitem_reference: an item of a response this bridge stored
instructions is the system prompt. As with OpenAI, it is not carried over through previous_response_id.
Parameters
Section titled “Parameters”| Parameter | Behavior |
|---|---|
max_output_tokens |
Default 16384. Above 65536 is capped. Always capped by the context left. |
temperature, top_k |
As in Chat Completions. |
reasoning.effort |
Absent, none or minimal: thinking off. low to max: on. |
include: ["reasoning.encrypted_content"] |
Returns reasoning items you can send back exactly. |
tools, tool_choice, parallel_tool_calls, max_tool_calls |
Function and custom tools. max_tool_calls is 1 to 128; the room writes at most 16 calls per answer either way. See Tool calling. |
text.format |
json_object or json_schema. See Structured output. |
previous_response_id, store |
See below. |
top_p, metadata |
Accepted. top_p is ignored. |
Stored responses and previous_response_id
Section titled “Stored responses and previous_response_id”With store (default true), the bridge keeps each response in memory. previous_response_id then continues from it, so you send only the new input.
- Up to 256 responses or 64 MB, whichever comes first. The least recently used goes first.
- Each is dropped an hour after its last use.
- Memory only: restarting the bridge forgets them.
- An unknown id is a
400with codeprevious_response_not_found.
Stored responses also back these endpoints:
GET /v1/responses/{id}DELETE /v1/responses/{id}GET /v1/responses/{id}/input_itemsOutput
Section titled “Output”Output items come in the order they were generated: reasoning, then the message, then calls. status is completed, or incomplete when the answer hit max_output_tokens or the context. A call cut short that way is an incomplete function_call item.
usage has input_tokens_details.cached_tokens (prompt tokens the room already held) and output_tokens_details.reasoning_tokens.
Streaming
Section titled “Streaming”A stream is the full Responses event sequence, each event with an increasing sequence_number: response.created, response.in_progress, the output item, content part and delta events, and finally response.completed, response.incomplete or response.failed.
While the request waits or the room reads a long prompt, the bridge repeats response.in_progress every 10 s: real events, since clients such as Codex reset their idle timer only on events.
Reasoning streams as a reasoning item with a reasoning_text content part: response.reasoning_text.delta events, then response.reasoning_text.done.
Skipped and refused
Section titled “Skipped and refused”Skipped, with one logged warning per client:
- hosted tools such as
web_search(Codex always sends it) - items from tools that ran elsewhere
A 400:
- a hosted tool in
tool_choice - a malformed
allowed_toolsentry background,conversation,prompt- logprobs
- unknown item types
GET /v1/responses/{id}?stream=true
/v1/responses/input_tokens and /v1/responses/compact are 404.