[ Samurai Quickstart ]
Start Free with Samurai API
Create an account, generate an API key, and send your first OpenAI-compatible request in minutes.
Create free accountGet running in three steps
1. Create your accountSign up free, then open API Keys.
2. Generate a keyCreate an API key and copy the full sk- value.
3. Send a requestPoint any OpenAI-compatible client at Samurai.
cURL
curl https://api.samuraiapi.io/v1/chat/completions \\\n -H "Authorization: Bearer sk-YOUR_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d '{"model":"glm-5.3","messages":[{"role":"user","content":"Say ok"}]}'Python
from openai import OpenAI\n\nclient = OpenAI(\n base_url="https://api.samuraiapi.io/v1",\n api_key="sk-YOUR_API_KEY",\n)\n\ncompletion = client.chat.completions.create(\n model="glm-5.3",\n messages=[{"role": "user", "content": "Say ok"}],\n)\nprint(completion.choices[0].message.content)JavaScript
import OpenAI from "openai";\n\nconst client = new OpenAI({\n baseURL: "https://api.samuraiapi.io/v1",\n apiKey: process.env.SAMURAI_API_KEY,\n});\n\nconst completion = await client.chat.completions.create({\n model: "glm-5.3",\n messages: [{ role: "user", content: "Say ok" }],\n});\nconsole.log(completion.choices[0].message.content);Streaming
const stream = await client.chat.completions.create({\n model: "glm-5.3",\n messages: [{ role: "user", content: "Write a one-sentence greeting" }],\n stream: true,\n});\n\nfor await (const chunk of stream) {\n process.stdout.write(chunk.choices[0]?.delta?.content ?? "");\n}