FunkyRouter DocsBeta

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

FieldTypeRules
modelstringRequired. Use cabeza-latest.
inputstring or arrayRequired. A string, or 1 to 64 items of {"role": "…", "content": …}.
instructionsstringOptional. System instructions.
streambooleanOptional. 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_tokensintegerOptional. 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.
temperaturenumberOptional. 0 to 2.
top_pnumberOptional. 0 to 1.
storebooleanOptional. false only.

In input items:

  • role is system, developer, user or assistant. The API reads developer as system.
  • content is a string, or an array of parts. Use input_text parts in all items. Use input_image parts in user items 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_id gives 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:

FieldContent
input_tokensPrompt tokens
output_tokensOutput tokens
total_tokensSum of the two
input_tokens_detailscached_read_tokens and cached_write_tokens, always 0
output_tokens_detailsreasoning_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:

  1. response.created
  2. response.in_progress
  3. response.output_item.added
  4. response.content_part.added
  5. response.output_text.delta (one or more)
  6. response.output_text.done
  7. response.content_part.done
  8. response.output_item.done
  9. response.completed or response.incomplete

The stream does not send [DONE]. It closes after the last event.

Last updated on

On this page