InferenceGetting started

API key

How to create an API key in the console, how to pass it in requests, and what to do if it falls into the wrong hands.

An API key is your program's password. It tells the Yenisei API whose request this is, which account to charge the credits to, and which models are available. A key is required for every request to the models.

Creating a key

Keys are created in the console: open console.yenisei.ru, go to the "Keys" section and click "Create key". The key is shown only once, so copy it to a safe place right away.

A key starts with sk-yn-.

Passing the key in a request

The key is passed in the Authorization header after the word Bearer:

Terminal
curl https://api.yenisei.ru/v1/models \
  -H "Authorization: Bearer $YENISEI_KEY"

Keep the key in an environment variable or a secrets store, not in your source code and not in the browser part of your application. Anyone who has the key can spend the credits of your account.

What to do if the key has leaked

Delete the key in the console and create a new one. The old key stops working immediately after deletion.

What the key gives access to

The key acts on behalf of your account: it has access to the same models and the same spending limits as your plan. If you request a model that is not included in your plan, the API returns the model_not_allowed error. See the Error codes page for details.