Skip to content

Error Codes

TokenSupernova uses standard HTTP status codes and returns errors in OpenAI-compatible format.

{
"error": {
"message": "Invalid API key provided",
"type": "invalid_request_error",
"code": "invalid_api_key"
}
}
CodeMeaningAction
200SuccessYour request was processed
400Bad RequestCheck your request body for errors
401UnauthorizedInvalid or missing API key
402Payment RequiredInsufficient balance — top up your account
404Not FoundModel or endpoint doesn’t exist
429Rate LimitedSlow down your requests
500Server ErrorSomething went wrong on our side — retry
503Service UnavailableModel temporarily overloaded — retry with backoff
{
"error": {
"message": "Invalid API key provided. Check your key at api.tokensupernova.com/console.",
"type": "auth_error",
"code": "invalid_api_key"
}
}

Fix: Verify your API key starts with tsn_live_ and was copied correctly.

{
"error": {
"message": "Insufficient balance. Top up at api.tokensupernova.com/console.",
"type": "billing_error",
"code": "insufficient_balance"
}
}

Fix: Add credits to your account via the console.

{
"error": {
"message": "Rate limit exceeded. Retry after 60 seconds.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}

Fix: Implement exponential backoff. See Rate Limits →

{
"error": {
"message": "Internal server error. Please try again.",
"type": "server_error",
"code": "internal_error"
}
}

Fix: Retry with exponential backoff. If the issue persists, contact support.

We recommend implementing exponential backoff for 429 and 5xx errors:

import time
import random
def retry_with_backoff(fn, max_retries=5, base_delay=1):
for attempt in range(max_retries):
try:
return fn()
except RateLimitError:
delay = base_delay * (2 ** attempt) + random.uniform(0, 1)
time.sleep(delay)
raise Exception("Max retries exceeded")