API Reference
Chat Completions
Send a list of messages and get a model reply — the core of the OpenLink API.
Endpoint
POST https://openlink-1.onrender.com/v1/chatAccepts 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
{
"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
}| Field | Type | Required | Notes |
|---|---|---|---|
| provider | string | no | Provider ID, or auto. Header x-openlink-provider beats body. |
| model | string | no | auto uses the provider default. |
| messages | array | yes | Includes the optional role: "system" message. |
| temperature | number | no | Default 0.7. |
| max_tokens | number | no | Default 4096. |
| stream | boolean | no | Default false. |
Response body
{
"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.