InferenceGetting started

Migrating from OpenAI

How to move a program written for the OpenAI API to the Yenisei API, and how the two APIs differ.

The Yenisei API follows the format of the OpenAI API, so you do not need to rewrite your program. It is enough to change two lines in the client settings, the address and the key, and put in a model name from the Yenisei catalog. Below is what exactly to change and where the two APIs diverge.

Address and key

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.yenisei.ru/v1",   # was api.openai.com
    api_key=os.environ["YENISEI_KEY"],      # key from the Yenisei console
)

Model name

The model name comes from the Yenisei catalog: for example, yenisei-100 instead of the name you are used to. The list of models available on your plan is returned by the GET /v1/models method.

What works the same

The messages, stream, temperature, top_p, seed, stop, response_format, tools, max_tokens, max_completion_tokens and reasoning_effort parameters are accepted in the same form as in the OpenAI API. The response also comes in the familiar form: the text in choices[].message.content, the token count in usage.

What differs

  • The max_tokens and max_completion_tokens values are cut down to the model's limit: you cannot ask for more than the model can produce.
  • Usage limits are counted in credits across three windows: session, week and month. See the Limits and usage page for details.
  • For reasoning models, the reasoning text comes in a separate field, choices[].message.reasoning. See the Reasoning page for details.