Beta docs: the shipped API is POST /api/v1/generate for gemini and sarvam. Some pages below describe planned features. See the shipped quick start.

API Reference

Chat Completions

Send a list of messages and get a model reply — the core of the OpenLink API.

Endpoint

terminal
POST https://openlink-1.onrender.com/v1/chat

Accepts JSON, returns JSON (or SSE when stream is true). Requires authentication with your API key. Idempotent only in the sense that a single request yields a single completion — see the Retries guide for how to replay safely.

Request body

JSON
{
  "provider": "auto",
  "model": "auto",
  "messages": [
    { "role": "system", "content": "You are terse and precise." },
    { "role": "user", "content": "Explain TCP handshake in one line." }
  ],
  "temperature": 0.7,
  "max_tokens": 256,
  "stream": false
}
FieldTypeRequiredNotes
providerstringnoProvider ID, or auto. Header x-openlink-provider beats body.
modelstringnoauto uses the provider default.
messagesarrayyesIncludes the optional role: "system" message.
temperaturenumbernoDefault 0.7.
max_tokensnumbernoDefault 4096.
streambooleannoDefault false.

Response body

JSON
{
  "id": "chatcmpl_01J8R2aKq...",
  "object": "chat.completion",
  "created": 1758432000,
  "provider": "anthropic",
  "model": "claude",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "A handshake is the connection setup phase where both ends agree on parameters before data flows." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 22,
    "total_tokens": 41
  }
}

choices is always an array with one element in v1. Treat finish_reason of "length" as a signal to continue the conversation with max_tokens guidance.

Streaming

Set stream: true to receive server-sent events of chat.completion.chunk. See the Streaming guide for the full walkthrough and chunk shape.

Errors

Non-2xx responses carry the error envelope. The most common chat-specific failures are 429 rate_limit_exceeded and 503 provider_unavailable.