Use models / API keys

API keys

Create and manage the keys your code calls models with.

API keys

The keys your code calls models with. Every key draws from your one balance; a spend cap is a limit inside that balance, not extra money.

Create a key

Press New key, give it a Name (the machine or agent that will use it is a good name), and optionally a spend cap. Create key shows the secret once, under Your key · shown once, with sample code already filled in under Try it. Copy it then: Shardio keeps only a fingerprint of it, so it cannot be shown again. If you lose it, revoke the key and create another.

An account can have up to 50 active keys.

Creating a key requires access to call models. While access is off, you can still read and revoke existing keys and reduce their spending limits.

The screen

  • Base URL and the code samples (curl, Python, JavaScript and Decisions) show how to call the API. The samples read your key from SHARDIO_API_KEY in your environment.
  • Each key's row shows its Name, the end of its secret (tsk_live_… and four characters), Spent (24 h) over the last 24 hours, its Spend cap and when it was Last used.
  • Edit changes the key's spend cap. Revoke, then Confirm revoke, stops the key for good: requests with it are refused from then on. Keep backs out.
  • Revoked keys at the bottom lists keys you have revoked, with the day each was revoked.

The Playground key

The key named Playground is created for you the first time you use the Playground, which bills it. It has no secret to copy and cannot be used from code. It starts with a spend cap of $5 a day; raise or remove that cap here with Edit to let the Playground spend more.

Each key's requests are in Activity, where you can filter by key.

Base URL

https://api.shardio.ai/v1

The address your code sends requests to. Shardio's API is OpenAI-compatible, so any OpenAI SDK, Claude Code, Cursor, OpenCode or other tool that lets you change the base URL can call Shardio with two changes: this base URL, and a Shardio API key.

Send the key as a bearer token:

Authorization: Bearer tsk_live_…

Then use a model id from the Models screen as model. Chat goes to /chat/completions under this URL; decisions go to /systemone.

A wrong, revoked or missing key is refused with invalid_api_key. Every route is in the API reference.

Spend cap

A limit on what one key can spend, so a looping agent or a leaked key cannot use up the credits your other keys need. It is a limit inside your balance, not extra money.

Set it when you create a key, or later with Edit:

  • Spend cap · USD: the most the key may spend. Leave it blank for no cap.
  • Resets: Every day, Every week or Every month, or Never (lifetime). Days start at midnight UTC, weeks run Monday to Sunday, and months start on the 1st.

The column shows the cap, how much of it is used in the current period, and when it resets. A request is refused with key_budget_exhausted when its largest possible cost would take the key past its cap, and nothing is billed. Your balance is untouched, so the fix is not more credits: raise the cap, wait for the reset, ask for fewer output tokens, or use another key.

While access to call models is off, you can lower a cap or make it reset less often. You cannot raise or remove a cap or make it reset more often. If you want a lower amount and a more frequent reset, make the two changes separately: lowering remains available, but the more frequent reset must wait until access returns.

A request already running when you change a cap may finish against the previous cap. Home lists any key that has used 80% or more of its cap.