Authorization header of each HTTP request, and the proxy validates it before forwarding anything upstream. There are no sessions, cookies, or OAuth flows to manage.
Your API key
Tokonomics API keys follow a fixed format: the prefixmk_ followed by exactly 48 lowercase hexadecimal characters.
Passing your key
Include your API key as a Bearer token in theAuthorization header of every request:
curl
Python (openai SDK)
openai SDK automatically sends whatever value you pass as api_key in the Authorization: Bearer header, so no additional configuration is needed.
Never include your API key in client-side code, browser bundles, or public repositories. Treat it with the same care as a database password. Use environment variables or a secrets manager to inject the key at runtime.
Multiple keys
You can create as many API keys as your plan allows and assign each one to a different service, team, or environment. This lets you:- Isolate spend by service — a key for your backend API, a separate key for your data pipeline, another for internal tooling
- Attribute cost by team — give each team their own key and filter dashboard spend by key
- Rotate keys safely — generate a replacement key, deploy it, then revoke the old one without any downtime
Error responses
If authentication fails or a limit is exceeded, Tokonomics returns a standard error response. The table below lists the authentication-related status codes you may encounter:| Status | Reason | Response body | Notes |
|---|---|---|---|
401 Unauthorized | API key is missing or invalid | {"error": "Unauthorized", "message": "Invalid or missing API key"} | Check that the Authorization header is present and that the key begins with mk_ |
429 Too Many Requests | Rate limit hit, or monthly budget cap reached | {"error": "Too Many Requests", "message": "Rate limit or budget cap exceeded"} | Includes a Retry-After header indicating how many seconds to wait before retrying |
401, verify that:
- The
Authorizationheader is formatted exactly asBearer mk_your_key_here(note the space afterBearer) - The key has not been revoked in your dashboard
- You are not accidentally sending a raw provider key (e.g.,
sk-...) instead of your Tokonomicsmk_key
429, check your dashboard to determine whether you’ve hit a rate limit or exhausted your monthly call quota. On the Free plan, you can upgrade to Pro to remove the call cap.