Skip to main content
POST
Create chat completion
/v1/chat/completions is the recommended DimiLinks chat endpoint. Its request and response structures match the official OpenAI endpoint, so you can use the OpenAI SDK directly. Set model to the name of a text model available to the current key to call Claude, GPT, or another model.

Request URL

Basic example

Response (abridged):

Streaming

Add "stream": true to the request. The server returns incremental chunks as text/event-stream and ends with data: [DONE].
Each event has this structure:

Parameters

The table lists common fields. Any unlisted field is passed through to the upstream provider when the model supports it.

Call with the OpenAI SDK

Python:
Node.js:

Tool calling

When the model returns tool_calls, execute the tool, add its result to messages as a role=tool message, and call the endpoint again.

Error handling

Failed requests return the OpenAI-style error wrapper. See Errors. If an upstream connection closes during a streaming request, the final event may not be [DONE]; treat a closed connection as a retryable error as well.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
required
Example:

"claude-sonnet-5"

messages
object[]
required
stream
boolean
default:false
temperature
number
top_p
number
max_tokens
integer
stop
presence_penalty
number
frequency_penalty
number
tools
object[]
tool_choice
response_format
object
user
string

Response

Chat completion result. When stream is true the response is text/event-stream.

id
string
Example:

"chatcmpl_xxx"

object
string
Example:

"chat.completion"

created
integer
Example:

1777080000

model
string
Example:

"claude-sonnet-5"

choices
object[]
usage
object