Clatter LabsHelp Center

How do I call the Model API with HTTPie?

How-toUpdated

HTTPie builds the JSON body from key=value pairs (:= for raw JSON).

http POST https://api.gateway.clatterlabs.xyz/v1/chat/completions \
  "Authorization:Bearer $CLATTER_API_KEY" \
  "X-Clatter-Account:$CLATTER_ACCOUNT_ID" \
  model=supercosmos-flash \
  messages:='[{"role": "user", "content": "Hello"}]'

Add --stream and stream:=true to watch a streamed reply.

Set CLATTER_API_KEY (a clsk_ key with models:invoke) and CLATTER_ACCOUNT_ID (your CL- Account ID from Console › Settings) first. Reference: Model API reference.

Good to know#

  • Retry only 429 and 5xx errors, with backoff; honour Retry-After when it's sent. Which errors to retry
  • Every response has an X-Request-Id; log it so a request can be found later. Why log it
  • Keep keys on your server, never in a browser or mobile app. Why

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.