Skip to main content

Error Response Format

All errors return a consistent JSON structure:

Complete Error Reference


Common Errors & Solutions

Symptoms: Every request fails immediately with auth_errorCauses & Fixes:
  • Key starts with sk-samurai- but was revoked → Create a new key in the dashboard
  • Passing OPENAI_API_KEY instead of your Samurai key → Use SAMURAI_API_KEY
  • Extra spaces or newlines in the key → Strip whitespace with .strip()
  • Header format wrong → Must be Authorization: Bearer sk-samurai-YOUR_KEY
Symptoms: Requests to Pro models (o1, Sora, DALL-E 3 HD) fail with insufficient_creditsFix:
  1. Go to Dashboard → Billing
  2. Purchase PAYG credits ($5 minimum)
  3. Credits are applied instantly
Note: Subscription plans (Free/Starter/Pro) give request quotas. PAYG credits are separate and needed for Pro-tier models.
Symptoms: Request works for some models but not othersCause: Your current plan doesn’t include that model class.Fix: Upgrade at Dashboard → Billing
Symptoms: Requests fail mid-session, especially for high-volume usePlan limits (requests per day):Fix: Implement exponential backoff (see below) or upgrade your plan.
Symptoms: Specific model fails but others work fineCause: The upstream provider (OpenAI, Anthropic, Google) is experiencing an outage.Fix: Use a fallback model:

Retry with Exponential Backoff

Model Fallback Pattern

Node.js Error Handling


Error Response Format

All errors return a consistent JSON structure:

Error Code Reference

Common Errors & Fixes

Problem: Your API key is missing, malformed, or revoked.Fix: Check that:
  • You’re passing Authorization: Bearer sk-samurai-YOUR_KEY
  • The key hasn’t been deleted from your dashboard
  • There are no leading/trailing spaces in your key
Problem: The model requires a higher subscription plan.Fix: Check which plan includes your target model at /reference/pricing. Upgrade from your dashboard.
Problem: Your PAYG credit balance is $0.Fix: Add credits from Dashboard → Billing. Pro models require PAYG credits on top of your subscription.
Problem: You’ve hit your daily request limit.Fix: Wait until midnight UTC for the limit to reset, implement request queuing, or upgrade your plan.
Problem: The upstream provider (OpenAI, Anthropic, etc.) is experiencing downtime.Fix: Implement fallback to another model:

Python Error Handling