Skip to content

Chat completions

POST /v1/chat/completions — parameters, headers, and the response object.

http
POST https://api.webway.example/v1/chat/completions

OpenAI-compatible. An SDK that accepts a base URL needs no other change.

Headers

Header Required Value
Authorization yes Bearer sk-ww-…
Content-Type yes application/json
Webway-ZDR no required to refuse retaining providers

Body

Field Type Notes
model string A catalogue name
messages array {role, content}, roles system / user / assistant
max_tokens integer Caps the completion, and its cost
temperature number Passed through where the provider supports it
top_p number Passed through
stream boolean Server-sent events — see Streaming
stop string or array Up to four stop sequences
thinking object {"type": "enabled" | "disabled"} on reasoning models

Unrecognised fields are forwarded to the provider rather than rejected, so a parameter we have not documented still reaches a model that understands it.

Response

json
{
  "id": "chatcmpl-9f2a…",
  "object": "chat.completion",
  "created": 1787526536,
  "model": "anthropic/claude-sonnet-5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {"role": "assistant", "content": "…"}
    }
  ],
  "usage": {
    "prompt_tokens": 41,
    "completion_tokens": 12,
    "total_tokens": 53
  }
}

usage is the same count the ledger prices, so a client that sums it will agree with the Usage screen.

Streamed response

With stream: true, chunks arrive as data: lines holding chat.completion.chunk objects, ending with data: [DONE].