Clatter LabsHelp Center

How do I count tokens before sending a request in Python?

How-toUpdated

Clatter Labs doesn't publish a tokenizer for SuperCosmos, so there's no exact way to count tokens offline. Practical approach:

  1. Send a representative request and read usage.prompt_tokens.
  2. Use the ratio of tokens to characters from that request to estimate similar texts.
  3. Keep a safety margin near limits (the 262K long-context threshold, max_tokens).

usage on every response is the exact, billed count.

Good to know#

  • Keep keys on your server, never in a browser or mobile app. Why
  • Each key has its own limit: 10, 30 (default), 60 or 120 requests per minute. Rate limits
  • Model ids: supercosmos-flash, supercosmos-max, supercosmos-heavy (SuperCosmos 1.1). Which to call

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.