API reference
Markdown ↗

Chat completions

Send OpenAI-compatible chat requests for an enabled model and pool. Use Bearer authentication.

Request

bash
curl https://api.zrelay.net/v1/chat/completions \
  -H "Authorization: Bearer $ZRELAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.1-sol","messages":[{"role":"user","content":"Hello from Zrelay"}],"max_tokens":256}'

Core request fields

FieldMeaning
modelRequired exact model identifier from the selected pool
messagesConversation messages in Chat Completions format
max_tokensBounded output budget; accepted controls depend on model
streamOptional true for server-sent events
toolsOptional tool schemas on models that support tools

Response

json
{
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello!"
      },
      "finish_reason": "stop"
    }
  ]
}

This is a partial response shape, not a complete schema. Tool responses can carry tool_calls instead of text. Usage details and optional fields depend on the selected route.

Grok and other chat models

For Grok, DeepSeek, Gemini, GLM and Kimi chat routes, use an exact enabled model ID and a matching key. Availability and endpoint support follow the catalog; do not send an Anthropic Messages body to this endpoint.

Streaming and failures

See Streaming, Tool calling and Errors.

Questions about your integration? support@zrelay.net