Every request to the models needs an API key. This page covers where to keep it, how to check it, and how usage is counted.
Get a key
Section titled “Get a key”Create an account, make a key on the API keys page, and request
credits on the Credits page. A key looks like yh-..., belongs to a project of your organization, and spends the
organization’s credits.
Organizations, projects and keys
Section titled “Organizations, projects and keys”- Organization: your company, lab or team. It holds the members, the credits and the projects. You can belong to several.
- Project: one use of the models, such as a pipeline, a product or a client. Each project has its own keys and its own usage and logs. Every organization starts with a Default project, and owners and admins can create more on the Projects page.
- Key: belongs to one project. A member’s own key is handed to the project if they leave. A project key (made by an owner or admin) is for production and keeps working when people come and go.
Credits are shared by the whole organization. To stop one project from spending them all, give it a monthly or total cap; each key can also have its own cap. Archiving a project revokes its keys and keeps its usage.
Keep it out of your code
Section titled “Keep it out of your code”Set the key as an environment variable. The Python library, the command line and agent skills all read it from there:
export YHAT_API_KEY="<your-key>"- Python:
Client()readsYHAT_API_KEY. You can also passClient(api_key="..."), or keep the key in a.envfile loaded with python-dotenv. - HTTP: send it as
Authorization: Bearer <key>. - Never commit a key, paste it into a shared notebook, or log it. The library never writes it to disk or to its logs.
Check your key
Section titled “Check your key”This confirms the key works and shows which models it can use and how much of its quota is left:
from yhatlabs import Client
yh = Client() # reads YHAT_API_KEY from the environmentme = yh.whoami()print(me["models"])print(me["usage"]["left"])['chakra-ts', 'chakra-tab']{'monthly': None, 'total': 1000}yhatlabs whoami{ "base_url": "https://api.yhatlabs.com", "key": "yh-...a1b2", "models": [ "chakra-ts", "chakra-tab" ], "usage": { "unit": "series", "used": { "monthly": 1000, "total": 1000 }, "quota": { "monthly": null, "total": 1000 }, "left": { "monthly": null, "total": 1000 }, "credits": { "used": { "monthly": 1000, "total": 1000 }, "quota": { "monthly": null, "total": null }, "left": { "monthly": null, "total": null } } }}Parameters: Client.whoami
models lists the models the key may call. usage.left is what remains of its quota per period: None in Python (null in
the CLI’s JSON) means no cap for that period.
Tags add up spend by experiment, pipeline or client. Give a key tags on its edit page (for example prod or
client-acme); they go on every call it makes. A call can add its own with a header:
curl https://api.yhatlabs.com/v1/series/forecast \ -H "Authorization: Bearer $YHAT_API_KEY" \ -H "X-Yhat-Tags: experiment-12,weekly" \ -H "Content-Type: application/json" -d @request.jsonUp to 10 tags per key and 10 per call: lowercase letters, digits and . _ : -, at most 40 characters each. Usage shows
spend by tag, and the logs filter by it.
Credits
Section titled “Credits”Calls spend credits from your organization. Each call is counted in tokens, from the work it causes (a forecast by its history
and horizon, a table call by its rows and columns), and paid in credits at your organization’s rate (1 credit per 1M tokens
by default). Amounts are shown with decimals: a small call costs about 0.02 credits, and every reply states its cost in
usage.credits. Limits has the rules, and POST /v1/estimate (or
yh.estimate_table()) the cost of a call before you make it. Your balance, what refills it and the last 30 days of use are on
the Credits page.
When the organization has no credits left, calls fail with HTTP 402 and error type no_credits; owners request more on the
Credits page. When a key’s or a project’s cap is reached, calls fail with HTTP 429 and error type quota_exceeded. A call
that fails on our side does not count.
Keys we issued directly (for example for a benchmark) carry their own quota instead: forecasts counted in series, tables in
credits, each with an optional monthly and total cap. When one is used up, calls fail with HTTP 429 and error type
quota_exceeded (RateLimitError in Python), which is not retried.
Use your own deployment
Section titled “Use your own deployment”To send requests to a dedicated or self-hosted deployment instead of the hosted API, set its address:
export YHAT_BASE_URL="https://your-deployment.example.com"In Python, Client(base_url=...) does the same for one client.

