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.

POSThttps://api.yenisei.ru/v1/chat/completions

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 role and content.

  • 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, medium or high. 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!"}]
  }'

Response

JSON
{
  "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

  • 401
    The API key is missing or invalid.
  • 403
    The model is not available on your plan.
  • 404
    There is no such model in the catalog.
  • 429
    The credit limit for the session, week or month window has been exhausted. The Retry-After header says when the limit resets.
  • 502
    The 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.