Samurai

[ API Documentation ]

One endpoint.
Every model.

Samurai speaks the OpenAI API dialect: point your existing SDK at https://api.samuraiapi.io/v1 and swap your key. GPT, Claude, Gemini, Llama and 20+ more — no markup on provider rates.

1 · Get an API key

Create an account, open the console, and click Create API Key. Requests are billed per token, pay-as-you-go — no minimums.

Sign up free →

2 · Make your first request

Streaming chat completion:

curl https://api.samuraiapi.io/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-sam-…" \
  -d '{
    "model": "gpt-5.6-sol",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Hello, Samurai!" }
    ]
  }'

3 · Swap the model, keep the code

The same request body works across every supported model — change one string:

"model": "gpt-5.6-sol"       // OpenAI
"model": "grok-4.7"           // xAI
"model": "glm-5.3-flash"      // Z.ai
"model": "deepseek-v4.1-flash" // DeepSeek (free tier)

4 · Use the OpenAI SDK

from openai import OpenAI

client = OpenAI(
    api_key="sk-sam-…",
    base_url="https://api.samuraiapi.io/v1"
)

resp = client.chat.completions.create(
    model="grok-4.7",
    messages=[{"role": "user", "content": "Summarize this contract"}],
)
print(resp.choices[0].message.content)

5 · Responses

Standard OpenAI-shaped JSON — familiar fields, streaming deltas, usage stats:

{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "gpt-5.6-sol",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "…" },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 98 }
}

6 · Errors

401 Unauthorized      → missing/invalid key
402 Payment Required  → out of quota — top up in the Wallet
429 Too Many Requests → rate limited, retry with backoff
503 Service           → provider down, Samurai failover will reroute

Ready to ship?

Questions or custom rates? [email protected] — or dive straight into the console.