Planet AI

Docs · Quickstart

3 minutes. One line of code.

Planet AI speaks OpenAI, Anthropic, and Gemini protocols natively. Pick your favorite SDK, change one URL, get 100+ models.

Endpoints

Three protocols, one key

ProtocolBase URLAuth header
OpenAI-compatiblehttps://api.withplanetai.cn/v1Authorization: Bearer sk-pl-...
Anthropic nativehttps://api.withplanetai.cn/anthropic/v1x-api-key: sk-pl-...
Gemini nativehttps://api.withplanetai.cn/gemini/v1betax-goog-api-key: sk-pl-...

You can use any one protocol to call any upstream model — e.g. call anthropic/claude-sonnet-4.6 through the OpenAI endpoint. Planet AI translates protocols transparently.

Naming

provider/model — the only naming rule

Every model is referenced as provider/model-id:

openai/gpt-5.4anthropic/claude-sonnet-4.6google/gemini-3.5-flashdeepseek/deepseek-v4-proqwen/qwen-3.6-flashmoonshot/kimi-k2.6zhipu/glm-4-flashxai/grok-4.20mistral/mistral-large-3

Full list at /models.

OpenAI-compatible (recommended)

Change base_url. Done.

quickstart.py
from openai import OpenAI

client = OpenAI(
    base_url="https://api.withplanetai.cn/v1",
    api_key="sk-pl-...",          # your Planet AI key
)

resp = client.chat.completions.create(
    model="anthropic/claude-sonnet-4.6",   # any provider/model id
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
quickstart.ts
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.withplanetai.cn/v1",
  apiKey: process.env.PLANET_AI_KEY,
});

const resp = await client.chat.completions.create({
  model: "openai/gpt-5.4",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);

Anthropic native

Use the Claude SDK as-is.

anthropic.py
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.withplanetai.cn/anthropic/v1",
    api_key="sk-pl-...",
)

resp = client.messages.create(
    model="anthropic/claude-opus-4.7",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.content[0].text)

The same anthropic/claude-* models are also reachable via the OpenAI-compatible endpoint above. Use whichever fits your stack.

Gemini native

Use the Google GenAI SDK.

gemini.py
from google import genai

client = genai.Client(
    api_key="sk-pl-...",
    http_options={
        "base_url": "https://api.withplanetai.cn/gemini",
    },
)

resp = client.models.generate_content(
    model="google/gemini-3.5-flash",
    contents="Hello",
)
print(resp.text)

The Gemini native entry currently translates from google/* models only. For non-Google models, prefer the OpenAI-compatible endpoint.

Capabilities

Streaming

stream.py
# OpenAI Python SDK, stream=True
stream = client.chat.completions.create(
    model="anthropic/claude-haiku-4-5",
    messages=[{"role": "user", "content": "Stream three numbers"}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content or ""
    print(delta, end="", flush=True)

SSE chunks arrive in OpenAI delta format regardless of upstream protocol. Planet AI translates Claude / Gemini event streams into OpenAI deltas transparently.

Capabilities

Function calling

tools.py
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

resp = client.chat.completions.create(
    model="openai/gpt-5.4",
    tools=tools,
    tool_choice="auto",
    messages=[{"role": "user", "content": "Weather in Tokyo?"}],
)
tool_call = resp.choices[0].message.tool_calls[0]
print(tool_call.function.name, tool_call.function.arguments)

Tool / function schemas translate between OpenAI tools, Anthropic tools, and Gemini function_declarations automatically.

Errors

HTTP status codes

StatusMeaningAction
401Invalid API keyRotate via dashboard
402Insufficient balanceTop up account
403Model not allowed for this keyCheck key permissions
429Rate limitBack off; raise tier or quota
500/502/503Upstream provider errorAuto-retried; will failover
524Stream timeoutLower max_tokens or retry

Privacy

Zero content retention by default

Planet AI does not store request bodies, response bodies, prompts, or generated content for routine traffic. Logs retain metadata only (request id, model, tokens, latency, status). You can opt in per-key to forward full traces to your own Langfuse / Datadog instance.

Get started

Grab a key