API & features
Call from code
Use the official OpenAI or Anthropic SDK and only change the endpoint and key. The rest of your code stays the same.
The examples read the key from the YUZU_API_KEY environment variable. Set it in your terminal first, or paste the key into the code to test.
OpenAI format (works everywhere)
Every group supports this format. Pick your language:
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.yuzuapi.com/v1", api_key=os.environ["YUZU_API_KEY"])
res = client.chat.completions.create(
model="gpt-6.2-sol",
messages=[{"role": "user", "content": "Hello"}],
)
print(res.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.yuzuapi.com/v1", apiKey: process.env.YUZU_API_KEY });
const res = await client.chat.completions.create({
model: "claude-sonnet-5-5",
messages: [{ role: "user", content: "Hello" }],
stream: true,
});
for await (const chunk of res) process.stdout.write(chunk.choices[0]?.delta?.content || "");curl https://api.yuzuapi.com/v1/chat/completions \
-H "Authorization: Bearer $YUZU_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-flash", "messages": [{"role": "user", "content": "Hello"}]}'Anthropic format (Claude)
With the Anthropic SDK, the endpoint has no /v1:
import os
import anthropic
# The Anthropic SDK endpoint has no /v1
client = anthropic.Anthropic(base_url="https://api.yuzuapi.com", api_key=os.environ["YUZU_API_KEY"])
msg = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)More examplesResponses API, list available models
Responses API (GPT / Codex models):
import os from openai import OpenAI client = OpenAI(base_url="https://api.yuzuapi.com/v1", api_key=os.environ["YUZU_API_KEY"]) res = client.responses.create(model="gpt-6.2-astra", input="Hello") print(res.output_text)
List the models your key can call:
curl https://api.yuzuapi.com/v1/models -H "Authorization: Bearer $YUZU_API_KEY"
Check balance and usage
Returns this key's remaining credit and usage. Not billed:
curl https://api.yuzuapi.com/v1/usage -H "Authorization: Bearer $YUZU_API_KEY"
| Field | Meaning |
|---|---|
remaining | What's left to spend: the key's remaining quota if it has a limit, otherwise your account balance |
quota | Only when the key has a limit: limit, used and remaining |
usage.today / usage.total | Requests, tokens and cost for today / all time |
daily_usage | Usage per day |
model_stats | Usage per model |
Amounts are in USD; the amount charged is actual_cost. The console shows CNY at about ¥6.67 per $1.