Core API

Chat completions

The workhorse endpoint. Identical to OpenAI's /v1/chat/completions in request and response shape, with a few additional tags + headers we add for observability and attribution.

Endpoint

POSThttps://api.ollima.com/v1/chat/completions

Request parameters

FieldTypeReq?Description
modelstringYESAlias (deepseek-v4) or long form (tensorzero::model_name::<v>::<m>).
messagesarrayYESConversation. See Message roles.
temperature0–2noDefault 0.7. 0 ≈ deterministic.
top_p0–1noNucleus sampling. Default 1.
max_tokensintegernoCap on completion length. Default varies by model.
streambooleannotrue → SSE. See Streaming.
stream_optionsobjectno{include_usage: true} emits a terminal usage chunk.
toolsarraynoFunction definitions. See Tool calling.
tool_choicestring/objectno"auto" | "none" | "required" | {type,function}.
response_formatobjectno{"type":"json_object"}. See Structured outputs.
frequency_penalty-2 to 2noPenalize repeats.
presence_penalty-2 to 2noEncourage novel topics.
stopstring/arraynoStop sequences.
userstringnoEnd-user identifier; captured as a tag.
seedintegernoBest-effort reproducibility (provider-dependent).

Response shape

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "created": 1781449284,
  "model": "deepseek-v4",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 47, "total_tokens": 59 }
}

Ollima-added response headers:

HeaderMeaning
X-Ollima-Request-IdUUIDv7 — share with support, search your activity log.
X-RateLimit-Remaining-PlanRequests left in the current minute on your plan.
X-RateLimit-Reset-PlanUnix seconds when the per-minute counter resets.

Message roles

RoleUsed for
systemPersistent instructions. First message by convention.
userHuman input.
assistantPrior model responses; may carry tool_calls.
toolResult of a tool call. Must include tool_call_id.

Image inputs

For vision-capable models, pass an array of content blocks instead of a string:

{
  "role": "user",
  "content": [
    {"type": "text", "text": "What's in this image?"},
    {"type": "image_url", "image_url": {"url": "https://…/cat.jpg"}}
  ]
}

Or use a data: URL for inline base64. Models that don't support vision return 400.