Responses
Request fields and streaming events for POST /v1/responses. Text and image input, without tools.
POST https://api.funkyrouter.ai/v1/responses
The endpoint uses the OpenAI Responses format. It accepts text and images and returns text. It does not support tools, stored responses or multi-turn state. For tool calling, use Chat completions.
The context window is 1,048,576 tokens. The prompt and the output share it. The request body can be 8 MiB. See Token limits.
Request fields
| Field | Type | Rules |
|---|---|---|
model | string | Required. Use cabeza-latest. |
input | string or array | Required. A string, or 1 to 64 items of {"role": "…", "content": …}. |
instructions | string | Optional. System instructions. |
stream | boolean | Optional. Default false. Set to true when the prompt is more than 131,072 tokens. If not, the API returns HTTP 400. Also set it for long answers. |
max_output_tokens | integer | Optional. No default. 1 to the context window, less the prompt. If you do not set it, the request can use the remainder of the window. The gateway then reserves credit for all of it. |
temperature | number | Optional. 0 to 2. |
top_p | number | Optional. 0 to 1. |
store | boolean | Optional. false only. |
In input items:
roleissystem,developer,userorassistant. The API readsdeveloperassystem.contentis a string, or an array of parts. Useinput_textparts in all items. Useinput_imageparts inuseritems only. Other part types are not accepted.
The API returns HTTP 400 for all other fields, for example tools, previous_response_id or reasoning. The 400 response does not identify the field.
Images
A user item can contain images and text:
{
"model": "cabeza-latest",
"max_output_tokens": 1024,
"input": [
{
"role": "user",
"content": [
{ "type": "input_text", "text": "What is in this image?" },
{ "type": "input_image", "image_url": "data:image/png;base64,iVBORw0KGgo…" }
]
}
]
}The rules and the token cost are the same as for Chat completions:
- The image must be a PNG, JPEG, GIF or WebP file in a base64 data URL. Each side must be 40 to 4,096 pixels.
- A remote URL or a
file_idgives HTTP 400. The API does not download files. - The API accepts
detail, but ignores it. - An image costs one input token for each block of 40 by 40 pixels. A 640 × 480 image costs 192 tokens.
Example
curl https://api.funkyrouter.ai/v1/responses \
--header "Authorization: Bearer $FUNKYROUTER_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "cabeza-latest",
"instructions": "Answer in one sentence.",
"input": "Why do people build in Texas?"
}'Response
The id field is resp_ and 32 hexadecimal characters. The text is in output[0].content[0].text.
The usage object has these fields:
| Field | Content |
|---|---|
input_tokens | Prompt tokens |
output_tokens | Output tokens |
total_tokens | Sum of the two |
input_tokens_details | cached_read_tokens and cached_write_tokens, always 0 |
output_tokens_details | reasoning_tokens, always 0 |
Field names
The cache fields are cached_read_tokens and cached_write_tokens. They are not OpenAI's cached_tokens.
Streaming
Set "stream": true to get typed server-sent events in this sequence:
response.createdresponse.in_progressresponse.output_item.addedresponse.content_part.addedresponse.output_text.delta(one or more)response.output_text.doneresponse.content_part.doneresponse.output_item.doneresponse.completedorresponse.incomplete
The stream does not send [DONE]. It closes after the last event.
Last updated on