Skip to content

Chat completions

POST /v1/chat/completions with OpenAI-compatible messages, tools, and streaming.

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

Use this endpoint with OpenAI SDKs and clients that speak the Chat Completions protocol.

Request

bash
curl https://api.webway.sh/v1/chat/completions \
  -H "Authorization: Bearer $WEBWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.6-terra",
    "messages": [{"role": "user", "content": "Say hello."}],
    "max_tokens": 128
  }'
Field Type Notes
model string Required provider-qualified model ID
messages array Required system, user, and assistant messages
max_tokens integer Maximum generated tokens
temperature number Sampling temperature
tools array OpenAI-compatible function definitions
tool_choice string or object Controls tool selection
stream boolean Streams server-sent events when true

Provider-specific fields are passed through when the selected model supports them.

Response

json
{
  "id": "chatcmpl_01…",
  "object": "chat.completion",
  "model": "openai/gpt-5.6-terra",
  "choices": [
    {
      "index": 0,
      "message": {"role": "assistant", "content": "Hello!"},
      "finish_reason": "stop"
    }
  ],
  "usage": {"prompt_tokens": 9, "completion_tokens": 2, "total_tokens": 11}
}

With stream: true, each SSE data: line contains a chat.completion.chunk; the stream ends with data: [DONE].