Client tokens
Base URL https://arteza.ai/api/v1
OpenAPI 3.1 specification, for SDK generators and agents: /api/v1/openapi.json
Official SDKs for TypeScript and Python, a command line and agent skills: SDKs and CLI
Never ship your API key in a mobile or web app: anyone can pull it out and spend your balance. Keep the key on your server and have it mint a client token for each session with POST /tokens. The app sends the token exactly where it would send a key.
# On your server, with the secret key:
curl https://arteza.ai/api/v1/tokens \
-H "Authorization: Bearer $ARTEZA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ttl_seconds": 900, "models": ["flux-2-max", "seedance-2"], "max_spend": 50, "user": "u_123"}'
# {"object":"client_token","token":"ark_tok_...","expires_at":"...","user":"u_123",...}
# In the app, with the token (never the key):
curl https://arteza.ai/api/v1/generations \
-H "Authorization: Bearer ark_tok_..." \
-H "Content-Type: application/json" \
-d '{"model": "flux-2-max", "input": {"prompt": "a lighthouse at dusk"}}'A token lives from 1 to 60 minutes (15 by default) and can be limited to a list of models or apps, capped at a spend in the key's own unit (credits, or USD for a USD key) and bound to one end user. A bound token tags every generation with metadata.user_id and only ever sees that user's generations. It spends the key's balance under the key's own limits, and stops working when it expires or the key is revoked.
A token can create, read, list, follow and cancel generations, upload files, get estimates and read the model and app catalogue. Everything else, including minting another token, needs the key and answers 403 token_not_allowed. Every endpoint answers CORS, so a browser can call it directly.