Clatter LabsHelp Center

How do I make my first Model API call?

How-toUpdated

You need a Clatter Labs account, an API key with the models:invoke permission, and your Account ID. It takes about two minutes.

  1. Sign in at accounts.clatterlabs.com (or create an account; new accounts get $5 of free credit).
  2. Create a key: Console › API keys › Create API key, pick the Model API preset. Copy the clsk_… key now; it's shown once.
  3. Copy your Account ID (like CL-7K2M9QXA) from Console › Settings.
  4. Send a request:
export CLATTER_API_KEY="clsk_..."
export CLATTER_ACCOUNT_ID="CL-XXXXXXXX"

curl https://api.gateway.clatterlabs.xyz/v1/chat/completions \
  -H "Authorization: Bearer $CLATTER_API_KEY" \
  -H "X-Clatter-Account: $CLATTER_ACCOUNT_ID" \
  -H "Content-Type: application/json" \
  -d '{"model": "supercosmos-flash", "messages": [{"role": "user", "content": "Write a haiku about the sea."}]}'
  1. Check the cost: the response has usage; the same call is in Console › Logs with its price.

If it doesn't work#

  • 401: the key or the X-Clatter-Account header is wrong. See invalid_api_key and missing_account_id.
  • 403 insufficient_scope: the key wasn't made with the Model API preset.
  • 402 out_of_credits: add credits in Console › Billing › Credits.

Python and JavaScript versions: Python, JavaScript.

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.