Authentication & keys
API keys
Section titled “API keys”Every request to the Turion API is authenticated with a bearer token that starts with tk_:
Authorization: Bearer tk_…Create as many keys as you need. Treat one like a password: it is shown once, at creation, and anyone holding it can train, deploy and call models, and spend your quota, on your account.
The same key works with OpenAI clients: it is the api_key you pass along with
base_url="https://api.turion.ai/v1". See Deploy & call.
Keys for OpenAI, Anthropic and other providers are a separate thing that you store on Turion;
see Providers & traces.
Your first key
Section titled “Your first key”On your own machine, run turion login: you approve it in the browser and the CLI gets a key of
its own, labelled cli: <machine> (see turion login).
For CI or a server, create one in the workspace:
- Sign in at turion.ai/members/keys with Google.
- Under API keys, give the key a label (
laptop,ci,prod) and click Create key. - Copy the token. This is the only time the full token is shown.
The same page lists every key on the account by prefix, with its status, when it was created and when it was last used, and a Revoke button on each active one. From then on you can also manage keys from the terminal.
Manage keys from the CLI
Section titled “Manage keys from the CLI”turion keys create --name ci# tk_… ← stdout, shown once# label ci id 0192… — shown once, copy it now
turion keys list# ID PREFIX LABEL CREATED LAST USED STATUS# 0192… tk_a1b2c laptop 2026-09-01 10:04 2h ago active# 0192… tk_c3d4e ci 2026-09-09 08:12 — active
turion keys revoke 0192…# revoke key 0192…? [y/N]: y# revoked 0192…keys createprints the token to stdout and everything else to stderr, soturion keys create --name ci > key.txtcaptures the secret and nothing else.keys listnever shows a token again.LAST USEDtells you which key a forgotten cron job is still using before you revoke it.--jsonprints the list as JSON.keys revokeasks first, and warns you when the key is the one the CLI is using.--yes(-y) skips the prompt.
Manage keys over the API
Section titled “Manage keys over the API”The same three calls accept either a tk_ key or a signed-in workspace session:
# create: the only response that carries the raw tokencurl -sX POST https://api.turion.ai/v1/account/keys \ -H "Authorization: Bearer tk_…" -H "Content-Type: application/json" \ -d '{"label": "ci"}'# {"id":"…","token":"tk_…","prefix":"tk_a1b2c","label":"ci"}
# list: prefixes only, newest firstcurl -s https://api.turion.ai/v1/account/keys -H "Authorization: Bearer tk_…"
# revoke: immediate, irreversible, 204 No Contentcurl -sX POST https://api.turion.ai/v1/account/keys/<key_id>/revoke \ -H "Authorization: Bearer tk_…"How keys behave
Section titled “How keys behave”- The token is shown once. Only its hash and prefix are stored, so nobody can show it to you again, including support. If you lose a key, revoke it and create another.
- Revocation is immediate. The next request with that key gets a
401. To rotate, create the new key, roll it out, then revoke the old one. - You can revoke the key you are using. The call succeeds and that token stops working from the response onward, which is what you want when a key leaks. The workspace signs in with a browser session, not an API key, so revoking every key never locks you out of it.
- Keys are scoped to your account. A key id that belongs to someone else answers
404. - Labels are for you. They need not be unique and carry no permissions; a blank one becomes
default. Every key on an account has the same access. Up to 64 characters, on one line.
Check a key and your limits
Section titled “Check a key and your limits”turion account# account Acme (@acme)# email ops@acme.com# key tk_a1b2c… laptop# since 2026-09-01 10:04## quota this month, 2026-10-01 to 2026-11-01 (UTC)# jobs and model calls in flight 4# gpu-seconds this month 412 / 7,200# warm replicas ceiling 1# full ledger: turion usage · per-version knobs: turion model get SLUGturion account shows who the key belongs to, the key’s prefix and label, and the limits the
account runs under, with this month’s GPU-seconds spent against the allowance. --json prints
the same as JSON.
New self-serve accounts start with 4 jobs and model calls in flight, 7,200 GPU-seconds (2 GPU-hours, the free allowance) a month and one replica per model. A training job, an agent run and a call to your fine-tune each count as one in flight. The GPU-second allowance is checked when work is submitted, so a single training job can use up the month. Email hello@turion.ai to raise your limits. Prices and usage in detail: Usage & billing.
turion login
Section titled “turion login”turion login# Sign in through your browser. Check that it shows this code:## KPRT-7WQM## https://turion.ai/members/cli?code=KPRT-7WQM## opened your browser# logged in as acme (config: ~/.config/turion/config.json)# next: turion bases · docs: https://turion.ai/docs/In a terminal, login signs in through the browser:
- It prints a short code and opens
turion.ai/members/cliwith it. Signed out, you sign in with Google first and land back on that page. - You check the code matches your terminal, and the page shows the machine name and the address the sign-in came from. Click Approve, or Cancel if you didn’t start it.
- The CLI, waiting meanwhile, gets a new API key for your account, labelled
cli: <machine>on the Keys page, where you can revoke it.
Codes last 10 minutes. Only approve a sign-in you started yourself: approving gives the waiting
terminal a key to your account. Over SSH, or anywhere without a browser, --no-browser prints the
link to open on any device.
Then login:
- Checks the key against
GET /v1/account, so a bad key fails immediately. - Saves the key, base URL and registry to the config file (see below).
It does not touch Docker. Only the Cog commands need the container registry, and
turion login --registry-login logs Docker in for them; see Registry access.
The base URL defaults to https://api.turion.ai. To point the CLI at a different API, pass it
with --base-url (or TURION_BASE_URL) the first time; it is remembered.
Log in without a prompt
Section titled “Log in without a prompt”When stdin is not a terminal, login reads the token from stdin instead of prompting. That keeps
the key out of the process table (where --token tk_… would put it) and out of your shell
history:
echo "$TURION_API_TOKEN" | turion login--token tk_… works too, and skips the browser. In CI you can also skip login and set
TURION_API_TOKEN; every command reads it.
Log out
Section titled “Log out”turion logout# logged out: removed the API key from ~/.config/turion/config.jsonlogout removes the saved key and keeps the base URL and registry. It also takes the key out of
an older ~/.turion/config.json if one is still there. The key itself stays valid:
revoke it with turion keys revoke or in the workspace if it should stop working. When
TURION_API_TOKEN is set in your shell, logout says so, because commands keep using it.
Environment variables
Section titled “Environment variables”| Variable | Purpose |
|---|---|
TURION_API_TOKEN | the tk_ API key |
TURION_BASE_URL | API base URL (default https://api.turion.ai) |
TURION_REGISTRY | container registry (default registry.turion.ai) |
TURION_CONFIG_PATH | config file location (default ~/.config/turion/config.json) |
XDG_CONFIG_HOME | an absolute path: the config file is $XDG_CONFIG_HOME/turion/config.json |
TURION_NO_PROGRESS | 1 turns off progress bars, spinners and live views on a terminal |
NO_COLOR | any value: plain output even on a terminal |
On a terminal the CLI draws tables, progress bars and live views. When its output is piped or redirected it prints plain lines instead, so scripts can parse it.
Config file and precedence
Section titled “Config file and precedence”turion login writes ~/.config/turion/config.json with permissions 0600, in a directory
with 0700:
{ "token": "tk_…", "base_url": "https://api.turion.ai", "registry": "registry.turion.ai"}The file is the first of these:
- The path in
TURION_CONFIG_PATH. $XDG_CONFIG_HOME/turion/config.json, whenXDG_CONFIG_HOMEis an absolute path.- On Windows,
%APPDATA%\turion\config.json. ~/.config/turion/config.json.
CLI versions before 0.4.4 kept it in ~/.turion/config.json. That file is still read until the
new one exists. The first command that saves the config (turion login, or turion logout with
a key saved) writes the new file with everything from the old one and prints one line saying so;
from then on the old file is not read. It is not deleted: remove it once no older CLI on the
machine needs it. With TURION_CONFIG_PATH set, only that file is read.
The CLI and SDK resolve each setting in this order:
- An explicit argument:
--token/--base-urlon the CLI (for exampleturion --token tk_… account),Client(api_token=…, base_url=…)in Python. - The environment:
TURION_API_TOKEN,TURION_BASE_URL,TURION_REGISTRY. - The config file above.
Registry access
Section titled “Registry access”Only Cog images go through the registry; training and serving fine-tunes
never touch it. The Turion registry accepts your API key as a Docker password. Before
turion cog deploy or turion cog push, run turion login --registry-login: it runs the Docker
login and exits 1 with Docker’s error if it fails. --registry picks a different registry. To
log in by hand:
echo "$TURION_API_TOKEN" | docker login registry.turion.ai \ -u <your-handle> --password-stdinImages live under your account handle, registry.turion.ai/<handle>/<model>:<tag>, and you can
only push to models under your own handle.