Skip to main content
POST
/
chat
/
completions
OpenAI Chat Completions
curl --request POST \
  --url https://api.linkmodel.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "claude-opus-4-7",
  "messages": [
    {
      "role": "user",
      "content": "Hello, who are you?"
    }
  ],
  "stream": false,
  "max_tokens": 1024,
  "stop": [
    "<string>"
  ]
}
'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1716000000,
  "model": "claude-opus-4-7",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "I'm an AI assistant. How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 18,
    "total_tokens": 30
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json
model
enum<string>
required

ID of the chat model to use. Must be one of the supported models listed above.

Available options:
claude-opus-4-7,
deepseek-v4-pro,
kimi-k2.6
Example:

"claude-opus-4-7"

messages
object[]
required

The conversation so far, as an ordered list of messages.

stream
boolean
default:false

If true, partial deltas are streamed as Server-Sent Events.

max_tokens
integer

Maximum number of tokens to generate in the completion.

Example:

1024

stop
string[]

Up to 4 sequences where the API stops generating further tokens. The generated text will not contain the stop sequence.

Response

Chat completion result. When stream is true, the body is an SSE stream instead.

id
string
Example:

"chatcmpl-abc123"

object
string
Example:

"chat.completion"

created
integer

Unix timestamp (seconds) of when the completion was created.

Example:

1716000000

model
string
Example:

"claude-opus-4-7"

choices
object[]
usage
object