Skip to content
HomeModels
DocsText & chat

Chat completions

Create conversations with models from different providers through one OpenAI-compatible endpoint. Supports multi-turn messages, multimodal input, tool calling, and streaming.

OpenAI compatibleStreaming supported
POST/v1/chat/completions
Base URLhttps://api.linkinfra.ai

Authorization

Bearer Token
AuthorizationBearer <token>

Authenticate requests with your API key in the request header:

Authorization: Bearer sk-your-api-key

Need a key? Create one in the console

Request body

application/json
modelstringrequired

Model ID from the model catalog. Availability depends on your account group and configured channels.

messagesarray<object>required

An ordered list of conversation messages.

Show child properties2
rolestringrequired

Message role, such as system, user, or assistant.

contentstring | arrayrequired

Text or multimodal content blocks. Supported content depends on the model.

streamboolean

Set to true to receive incremental Server-Sent Events. Defaults to false.

temperaturenumber

Sampling temperature, typically 0–2. Supported values depend on the model.

max_completion_tokensinteger

Upper limit for generated tokens. Check that the model supports this parameter.

toolsarray<object>

Definitions of tools the model may call.

Show child properties2
typestringrequired

Tool type. Use function for function tools.

functionobjectrequired

Function name, description, and parameters (JSON Schema).

response_formatobject

Output format, for example {"type":"json_object"}. Requires model support.

Set stream to true and read choices[0].delta.content from each data: event until data: [DONE]. With cURL, add -N to disable output buffering.

Response

application/json
200Successful response
idstring

Unique identifier for the completion.

choicesarray<object>

Generated choices. Text is in message.content.

usageobject

Token usage for this request. Check usage logs in the console for actual charges.

Request failed? Read the error handling guide