Create an API key, connect a model and see how each request is billed.
Quickstart
Create a key in the console and select its settlement currency. Load the key into the TOKENRUT_API_KEY environment variable on your server or in your local terminal. Sign inAPI keys
Use an ID from the model list for your key. A model must support the endpoint you want to call. Models and pricesGET /v1/models
Replace MODEL_ID in the example, then run it in your terminal. A successful chat reply appears in choices[0].message.content.
Send the TokenRut key as Authorization: Bearer <key>. Send JSON POST requests with Content-Type: application/json. Use HTTPS for a public instance.
Keep keys in an environment variable or secret manager. If a key is exposed, revoke it in the console and issue a replacement. Keep keys out of browser code, URLs and logs.
For OpenAI-compatible SDKs, set the base URL to the example request’s gateway address up to and including /v1. For an Anthropic SDK, use the gateway URL before /v1 so the client can append /v1/messages.
API endpoints
The examples use the public TokenRut API. Model access depends on your key and the channels configured by the operator.
Stream a chat reply
Add stream: true to the chat request to receive server-sent events (SSE). Use curl -N to print each event as it arrives.
Send text in input to an embedding model. Read the vector from data[0].embedding.
cURLPOST /v1/embeddings
curl 'https://tokenrut.com/v1/embeddings' \
-H "Authorization: Bearer $TOKENRUT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"input": "A short sentence to embed."
}'
Wallets and billing
Each key settles in one currency. Balances in USD, CNY and RUB are tracked separately.
USD
Default when a currency is omitted. Use a USD key for endpoints outside the CNY/RUB allowlist, including asynchronous tasks and realtime WebSockets, where enabled.
CNY
Chinese yuan. CNY pricing depends on the operator’s configured rate.
RUB
Russian ruble. RUB pricing depends on the operator’s configured rate.
CNY and RUB can be used with the HTTP chat, text completions, Responses, Messages and embeddings endpoints. The selected channel must be OpenAI-compatible, Anthropic or DeepSeek. HTTP streaming is allowed on supported endpoints and channels, with a 30-minute request limit for CNY and RUB.
If your balance is insufficient, fund that wallet or use a key for a different funded currency. Funds in other wallets are never applied automatically.
Use Wallets to check available balances and Usage logs to check the currency and amount charged for a request. The optional API key limit and the wallet balance are separate.
Check the JSON fields, the model ID and whether the selected channel supports your key’s currency.
401
Check that the Bearer header reaches the gateway and that the API key is active.
403
Check the key’s model permissions, wallet currency and available balance.
404
Check the full request path and verify that the model ID appears in GET /v1/models for this key.
429
Wait before retrying and lower concurrency if requests keep hitting the limit.
5xx
Check the response and usage log before retrying. If the problem continues, share the request ID with your operator.
For support, save the HTTP status, time, model ID and the X-Oneapi-Request-Id response header if present. Remove keys and sensitive request contents before sharing.
Administration
Set the public gateway address for client examples. Configure only trusted upstreams, then test the channel with a model you plan to enable.
Authorized staff can add wallet credit from the user’s wallet panel after re-authentication. Configure WALLET_CNY_PER_USD and WALLET_RUB_PER_USD on the gateway to enable request settlement for those currencies.