Send the project key
Issue a key in Projects and keys. Copy the full value when it is first shown. Send it as Authorization: Bearer <key> or, for the Messages API, x-api-key: <key>. Keep it server-side. The email code used to enter the console has a separate purpose.
Understand the wallet and budget
A key identifies a project and its organization. Projects in the same organization use the same available and reserved RUB balances. A project budget or key budget limits the spending attributable to that project or key. Use separate projects for distinct clients and workloads. Look up a request with the project key used to create it.
Identify the budget that blocked a call
A monthly project budget covers its keys. Each key can also have its own daily budget. If the gateway returns 403 budget_exceeded, inspect error.scope, error.period and error.reset_at to identify the relevant budget and its next reset. X-Max-Cost-Rub separately bounds the estimated RUB cost of one operation. Exported api_key_id is an identifier for reconciliation; keep the secret key out of reports.
Rotate a key
Create a replacement in the same project, update the deployment secret, then perform a read-only GET /v1/models. Once the new key is in use, revoke the old key in the console. Check your request history by project or key when reconciling usage.