Error codes

cn2.ai uses structured JSON error responses with consistent error codes. All errors include an error message and a machine-readable code field.

Payment errors

StatusDescriptionAction
402Payment Required — initial challenge or invalid credentialPay the challenge amount and retry with a credential
402Spend cap exceededIncrease your monthly spend cap in account settings

Routing errors

StatusCodeMeaning
404UNKNOWN_PROVIDERThe subdomain does not match any supported provider
503NO_AVAILABLE_KEYSNo seller keys available for this provider and tier
503NO_EU_KEYSYour IP is in the EU but no EU-tagged keys are available for this provider
502UPSTREAM_UNAVAILABLEAll eligible keys failed — the upstream provider may be experiencing issues

Upstream errors

When the upstream provider returns a client error (400, 403, 404, 422), cn2.ai forwards it to you unchanged — you are not charged. These are buyer errors (incorrect request format, missing fields, etc.).

When the upstream returns a server error (401, 429, 5xx), cn2.ai automatically retries on another seller's key. If all retries fail, you receive a 502. You are never charged for failed requests.

Platform errors

StatusCodeMeaning
401Missing or invalid authentication token (platform API only)
500PLATFORM_ERRORInternal error — you are not charged. Try again.

Error response format

{
  "error": "No EU keys available for this provider",
  "code": "NO_EU_KEYS",
  "provider": "openai",
  "tier": "standard",
  "region": "eu"
}

Some errors include additional context fields like provider, tier, region, suggestion, and gdprNote.