Skip to main content
OpenPAI is an API gateway: your app → OpenPAI → the upstream model provider. Understanding a few key concepts before you start will save you some pitfalls.

Account (User)

Represents a real user or team. An account holds quota, and every API call is billed against it. An account belongs to a group, which determines the multiplier applied when the account uses a model.

Token (API key)

A string like sk-XXXXXXXX that serves as your credential when calling the API. One account can create multiple tokens, and each token can be configured separately:
  • Quota limit: the maximum amount this token may spend (-1 means unlimited).
  • Expiry: leave empty for no expiry.
  • Model scope: an allowlist of models this token may call (empty = all).
  • IP allowlist: restrict calls to specific IPs (optional).
Create a separate token for each app / environment (test, production) to make tracking spend and revoking easier.

Group

Groups implement tiered pricing. For example:
GroupMultiplierUse case
default1.0×Regular users
vip0.8×Auto-upgraded after topping up ¥100
svip0.5×Enterprise customers
When different groups call the same model, the actual charge is multiplied by the group’s multiplier. Groups can also be linked to channel groups — higher tiers are routed to more stable upstream channels.

Channel

A channel is the connection config between OpenPAI and an upstream model service. One model can be served by multiple channels:
gpt-5.5
  ├── Channel A: OpenAI official, weight 70
  ├── Channel B: Azure OpenAI, weight 20
  └── Channel C: backup proxy, weight 10
Each request randomly selects a healthy channel by weight, and automatically retries the next channel on failure. Channel-level details are completely transparent to the caller — you only need the model ID.

Model

Model IDs match the upstream’s official names, e.g. gpt-5.5, claude-opus-4-8, gemini-3.1-pro-preview. In the OpenPAI console or the Models overview you can view:
  • Model ID and its upstream
  • Input / output price multipliers
  • Context window
  • Supported capabilities (vision, tools, streaming, caching, etc.)

Tokens and quota

OpenPAI uses token-based billing, consistent with OpenAI:
  • prompt_tokens: the input tokens you send to the model.
  • completion_tokens: the output tokens the model returns.
  • cached_tokens: tokens that hit the prompt cache, billed at a lower rate.
  • reasoning_tokens: chain-of-thought tokens produced by reasoning models (invisible but billed).
The final charge (simplified):
charge = (prompt × input multiplier + completion × output multiplier + cached × cache multiplier)
         × model group multiplier
         × user group multiplier
See Billing for the detailed rules.

Endpoint

OpenPAI exposes 3 protocol endpoints at once; pick the one that matches your existing code:
ProtocolEndpoint prefixAuth header
OpenAI-compatiblehttps://openp.ai/v1/...Authorization: Bearer sk-...
Claude Messageshttps://openp.ai/v1/messagesx-api-key: sk-... + anthropic-version
Gemini nativehttps://openp.ai/v1beta/models/{model}:...x-goog-api-key: sk-...
All three endpoints share the same sk- key and account quota — just choose the protocol closest to your existing application.