Skip to main content

Step 1: Get your API Key

  1. Sign up at samurai-ai.com
  2. Go to your Dashboard
  3. Click API Keys → Create New Key
  4. Copy your key — it starts with sk-samurai-
Store your API key in an environment variable. Never commit it to version control or expose it in client-side code.

Step 2: Install the SDK

Use the official OpenAI SDK — no special Samurai package needed:

Step 3: Set your environment variable

Or create a .env file:
.env

Step 4: Make your first request

You’ll get a response like:

Try a cheaper model (same quality)

Try streaming

What’s next?

Chat Completions

Full parameter reference and multi-turn examples.

Streaming

Real-time streaming with SSE and Vercel AI SDK.

All Models

GPT-4.1, Claude Opus 4, Gemini 2.5 Pro, Llama 3.3 and 400+ more.

API Playground

Test every endpoint live in your browser.

Step 1: Get your API Key

  1. Sign up at samurai-ai.com
  2. Go to your Dashboard
  3. Click API KeysCreate New Key
  4. Copy your key — it starts with sk-samurai-
Never share your API key or commit it to version control. Always use environment variables.

Step 2: Install the SDK

Samurai AI is 100% OpenAI-compatible. Use the official OpenAI SDK — no special package needed:

Step 3: Make your first request

What’s next?

Chat Completions

Learn all parameters and options for chat.

Browse Models

See all 400+ available models.

Image Generation

Generate images with DALL-E 3, Flux, and more.

Streaming

Stream responses in real time.