Skip to main content
POST

Authorizations

Authorization
string
header
required

All endpoints require Bearer Token authentication. Add to the request header:

Authorization: Bearer YOUR_API_KEY

YOUR_API_KEY is the API Token (sk-... format).

Body

application/json
model
string
required
Example:

"claude-opus-4-7"

prompt
string
required

User prompt, up to 100,000 characters.

Maximum string length: 100000
Example:

"Describe this image in one sentence."

image_urls
string[]
required

Array of image sources (1–10 images). Each element accepts one of the following two forms:

  • Publicly reachable HTTP/HTTPS URL
  • data:image/<type>;base64,<payload> data URI (base64 inline)

Model constraints: the maximum count is determined by the upstream behind the selected model; when a model supports only a single image but the request passes multiple, the routing layer returns 422 model_rule_violation (the specific rules are maintained in app/relays/llm_router/model_rules.py, covering "model-intrinsic" constraints beyond channel configuration).

Inline base64 (asynchronous mode only, when sync is omitted or false): Base64 recognized by the gateway as inline media (data: URI, or at least 4096 encoded characters whose decoded content matches a known media signature) is uploaded to file storage and replaced with a URL before the request is persisted or submitted upstream; the original base64 is not stored. Shorter raw base64 or content with an unrecognized signature is passed through unchanged and is not size-validated. Limits apply only to inline base64 items (public HTTP(S) URLs are not limited): decoded size ≤ 5 MB per item, ≤ 5 inline items per array, ≤ 10 MB total per request, and ≤ 20 inline items per request. An invalid data: prefix or payload that decodes to zero bytes returns 422; exceeding a limit also returns 422. Use /v1/files/upload first and pass the resulting URL instead.

When sync: true, the request is not stored as a task and the rules above do not apply: inline base64 is submitted upstream unchanged without size or count validation.

Required array length: 1 - 10 elements
Example:
sync
boolean
default:false

Synchronous mode (see llm-text schema).

Example:

false

stream
boolean
default:false

Whether to stream (see llm-text schema).

Example:

false

max_tokens
integer | null

Generation token limit. Optional.

Required range: x >= 1
Example:

64

temperature
number | null

Sampling temperature, range [0, 2]. Optional.

Required range: 0 <= x <= 2
Example:

0.3

system_prompt
string | null

System instruction. Optional.

Maximum string length: 10000
Example:

"You are a vision assistant."

reasoning
boolean | null

Whether to include reasoning tokens. Some thinking models require this to be set to true.

Response

Task created (async mode) / full response (sync mode)

Submit response, conforming to the unified task standard shape. results / error are fixed at null during submit; they are returned via GET /v1/tasks/{task_id} after the task completes or fails. In sync=true, stream=false mode, the endpoint directly returns the full OpenAI ChatCompletion JSON.

id
string
required

Task ID, formatted as task-llmrouter-{timestamp}-{8random}.

Example:

"task-llmrouter-1776874565-yq3szvcu"

object
enum<string>
required
Available options:
llm.generation.task
Example:

"llm.generation.task"

type
enum<string>
required
Available options:
llm
Example:

"llm"

model
string
required

The model name submitted by the client (echoed verbatim)

Example:

"claude-opus-4-7"

status
enum<string>
required
Available options:
pending
Example:

"pending"

progress
integer
required
Example:

0

created
integer
required
Example:

1776874565

stream
object · null · null

Returns {url: ...} when stream=true; null when stream=false.

results
object[] | null

Fixed at null during submit; returned via GET /v1/tasks/{task_id} after the task completes — results[0] is the full OpenAI ChatCompletion response.

Example:

null

error
object | null

Fixed at null during submit; returned via GET /v1/tasks/{task_id} when the task fails.

Example:

null