InferenceReference
Chat Completions
The main method of the Yenisei API, which returns a model reply to a conversation and accepts the same parameters as the OpenAI API.
Chat Completions is the main method of the Yenisei API: you pass the messages of a conversation to the model, and it returns a reply. The same method powers streaming, tool calling, JSON output and reasoning. The request and response format matches the OpenAI API, so any OpenAI SDK will work.
Parameters
modelstringrequired
Model name from the catalog, for example
yenisei-100.messagesarrayrequired
Messages of the conversation. Each message has a
roleandcontent.streamboolean
If set to
true, the reply arrives in parts as SSE events. See the Streaming page for details.temperaturenumber
Variety of the reply. The default value is 1.
top_pnumber
Selection of likely tokens. The default value is 1.
max_tokensinteger
Maximum reply length in tokens. A value larger than what the model can produce is cut down to the model's limit.
stopstring | array
A string or a list of strings at which the model stops the reply.
seedinteger
A number that helps get repeatable replies.
response_formatobject
Reply format. The value
{"type": "json_object"}turns on JSON output. See the JSON output page for details.toolsarray
Descriptions of functions the model may ask to call. See the Tool calling page for details.
reasoning_effortstring
Reasoning depth for models that can reason:
none,low,mediumorhigh. See the Reasoning page for details.
curl https://api.yenisei.ru/v1/chat/completions \
-H "Authorization: Bearer $YENISEI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "yenisei-100",
"messages": [{"role": "user", "content": "Hello!"}]
}'
from openai import OpenAI
client = OpenAI(base_url="https://api.yenisei.ru/v1", api_key=YENISEI_KEY)
resp = client.chat.completions.create(
model="yenisei-100",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai"
const client = new OpenAI({
baseURL: "https://api.yenisei.ru/v1",
apiKey: process.env.YENISEI_KEY,
})
const resp = await client.chat.completions.create({
model: "yenisei-100",
messages: [{ role: "user", content: "Hello!" }],
})
console.log(resp.choices[0].message.content)
Response
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "yenisei-100",
"choices": [{
"index": 0,
"finish_reason": "stop",
"message": { "role": "assistant", "content": "Hello there!" }
}],
"usage": { "prompt_tokens": 9, "completion_tokens": 4, "total_tokens": 13 }
}
Errors
- 401The API key is missing or invalid.
- 403The model is not available on your plan.
- 404There is no such model in the catalog.
- 429The credit limit for the session, week or month window has been exhausted. The
Retry-Afterheader says when the limit resets. - 502The model did not respond. Retry the request.
The remaining credits in the session window come in the
X-RateLimit-Remaining-Session header, and the time the limit resets comes in
the X-RateLimit-Reset header. All codes and headers are described on the
Error codes and Limits and usage
pages.