API keys can now enforce monthly USD spend limits

Speechify API keys can now carry a monthly USD spend limit, returning 402 spend_cap_exceeded once a key reaches its budget for the calendar month.

Developer Relations · SpeechifyAI Labs
1 min read

Speechify API keys can now carry a monthly USD spend limit. Once the key reaches its budget for the current calendar month, new requests fail with 402 spend_cap_exceeded until you raise the limit, use another key, or the month rolls over.

Spend limits are the blast door for API credentials. If a key leaks, a script loops, or a test workload accidentally points at production, the key can only spend the budget you gave it.

What does the limit cover?

The limit is per API key and measured in US dollars. It counts billed usage through the same billing engine that produces your invoice, which means it covers speech synthesis, Agents calls, outbound batches, and LLM gateway usage where that key is the caller.

Keys without a limit behave exactly as before.

The window is the calendar month in UTC. Limits reset automatically at 00:00 UTC on the first day of the month.

What happens when a key reaches the limit?

New requests fail with the standard error envelope:

{
  "error": {
    "code": "spend_cap_exceeded",
    "message": "This API key has reached its monthly spend cap."
  },
  "request_id": "..."
}

Handle this separately from payment_required. payment_required means the workspace balance needs attention. spend_cap_exceeded means this particular key reached the budget you chose for it.

In-flight calls are not cut off. The limit gates new requests and new dispatches.

Where to configure it

Set a limit when creating a key, or edit an existing key from the API Keys page in the console. The secret does not change when you add, raise, lower, or remove a limit.

Read the spend limits guide for the exact behavior and error shape.

Privacy preferences

Choose what we may store on this device. You can change this at any time from the footer.

Strictly necessary

Sign-in, security, load balancing, and remembering your privacy choices. These cannot be switched off.

Always on

Analytics

How the site is used in aggregate - which pages get read, where people get stuck - so we can improve it.

Marketing

Measures which campaigns bring people here, and lets us show relevant ads on other platforms.