config JSON, and a pool of credentials. A channel can
carry any number of providers; openai-main and openai-eu can both be on the
openai channel.
Choosing a channel
Only the channels compiled into your binary exist. The default build includes every channel in the repository; a binary built with individual channel features carries only those.GET /admin/api/channels answers from the binary,
not from the database. Each entry lists the channel’s login modes, its
capabilities and the config keys a provider form should render; the
channel catalogue prints the same data for the
current release.
AI Studio Playground
playground uses a Google session from AI Studio.
It supports Gemini generation, streaming, inline media, function calls and
model discovery. The API-key channel remains aistudio.
Google requires a WAA proof with every generation request. GPROXY generates
the proof in process: no separate signing service is needed, and the cookies
and request contents are not sent to a third party. The signer embeds QuickJS.
The first generation for an account initializes the signing environment and is
slower than the ones that follow.
Creating the provider
In the Console, create a provider with the channel Google AI Studio Playground. No other configuration is needed. The same through the admin API:Importing the cookies
- Sign in to AI Studio in a browser, then open
www.google.comonce. Google issues the rotating session cookies at that point; without them GPROXY cannot rotate the session. - Return to the AI Studio page. In Cookie-Editor, export the site’s cookies as JSON or Header, including HttpOnly cookies.
- Optional:
LSID,__Host-1PLSID,__Host-3PLSIDand__Host-GAPSbelong toaccounts.google.comonly. Cookie-Editor exports the current page’s cookies and cannot reach them, and openingaccounts.google.comredirects tomyaccount.google.com. To include them, use an extension that exports across domains, such as Cookie Editor by navbytes in the Chrome Web Store: in its cookie manager select.google.com,.aistudio.google.comandaccounts.google.comand export them together as JSON. If you export them separately, paste the exports one after another; the import merges them into one credential. GPROXY sends these cookies only when it rotates the session; if step 1 issued the session cookies, rotation works without them. - In the provider’s credentials, choose Import credentials → Cookie-Editor /
Cookie Header, paste the export, and import. The entire cookie jar becomes
one credential. To import several accounts at once, paste their exports one
after another, or one Cookie header per line; each becomes its own
credential. For another signed-in Google identity, import
{"cookies": [...], "auth_user": "1"}; the default login index is0.
inlineData rather than fileData.
countTokens uses GPROXY’s existing local tokenizer and returns totalTokens.
It does not call Google or generate a proof. The result is a local estimate and
may differ from Google’s official count.
Common errors
Compatible vendors
A vendor that differs from a stock API only in its origin and headers does not need its own channel. Configure it as acustom provider and list the wire
formats it speaks:
custom providers; each now has a channel, which adds its
own authentication and balance queries, and should be preferred.
Creating a provider
In the Console, open Providers, choose New provider, pick the channel, fill in the name and the fields the channel’s form shows, and Save. Then add credentials (see Credentials) and test one before you add the provider to a model route. The same through the admin API:Provider configuration
For
custom, config carries dialects (the wire formats the endpoint
speaks), static headers, allowed_headers and the two magic-cache switches.
Channels that impersonate a vendor CLI set their own identity headers and do
not let a client override them.
The sections below describe the options of individual channels.
Claude model fallback
fallback_mode is off (the default), default or models.
fallback_models is an ordered list of upstream model IDs. The Console renders
both fields from the channel descriptor. Blank entries, duplicates and the
primary model are skipped, and at most three fallback models are used.
How the fallback runs depends on the channel:
- Claude API, Claude Code and custom Claude endpoints send Anthropic’s
fallbacksfield with the matching beta header. Indefaultmode Anthropic chooses the fallback model. - OpenRouter receives
fallbacksfor Claude Messages ormodelsfor Chat Completions, and runs the fallback itself. This does not changeprovider.allow_fallbacks, which controls supplier routing for the same model. If the client already sentfallbacksormodels, the client’s value is used. Responses requests get no fallback parameter, because OpenRouter documents none for them. - Vercel, Azure, Vertex and AWS Bedrock: GPROXY itself retries a Claude
refusalon the next configured model through the same credential, preparing and signing the request again.defaultmode selectsclaude-opus-4-8in the primary model’s namespace. For cloud-specific model IDs, configure the full IDs that upstream accepts.
Claude Code usage-limit modes
Twoclaudecode switches control what happens when the subscription runs
into its limits. Both default to false.
-
low_priority: true: After a five-hour limit rejection, accept the lower-priority offer the server makes. The session then sendsanthropic-usage-limit: slowuntil that window resets or the server ends the mode. Weekly limits and the separate lower-priority allowance still apply. -
extended_usage: true: Sendanthropic-usage-limit: extendedon tool-result continuations when paid extra usage is not known to be enabled. The server decides whether grace is available; it does not reset the subscription quota.
slow or extended itself is honoured even with both
switches off; the two values are mutually exclusive. CountTokens and control
requests never carry the header. For clients other than Claude Code, a
tool-result message is what marks a continuation: the CLI’s private task-depth
and experiment flags are not visible to the gateway.
While it is sending slow, GPROXY waits on 429 slot_busy and overload
responses and retries the same buffered request on the same credential. As in
CLI 2.1.302, the default delay is 20 seconds with 30% jitter, and the default
maximum wait is 20 minutes. Server hints are clamped to 5–600 seconds per delay
and 1–360 minutes in total. The host deadline or a cancellation can end the
wait earlier. Budget, weekly-limit and eligibility refusals are returned
without retrying, and a response stream that has started, a body that cannot
be replayed, or an opaque fallback-credit redemption is never replayed.
The quota view also records the lower-priority and grace allowances the server
reports. They do not block normal traffic. An explicit mode exempts only the
subscription windows it applies to, for that request; local budgets, scoped
model limits and upstream failure or rate-limit cooldowns still apply.
Claude Code client identity
client_identity selects which first-party client the claudecode channel
presents itself as. Both identities are the same CLI binary on the same OAuth
token.
-
cli(default): The interactive CLI,claude-cli/2.1.318 (external, cli). A valid CLI user agent and billingcc_entrypointsent by the client are kept. -
agent_sdk: The Claude Agent SDK 0.3.318,claude-cli/2.1.318 (external, sdk-ts, agent-sdk/0.3.318). A client’s own Agent SDK user agent (sdk-tsorsdk-pywithagent-sdk/…) is kept; any other is replaced. The billing block’scc_entrypointfollows the user agent, and the turn is marked as an SDK turn (cc_turn_origin=sdk,cc_prompt_index=0).
identity_system_block: true (default false) places the identity system
block directly after the billing block, matching the billing cc_entrypoint:
You are Claude Code, Anthropic's official CLI for Claude. for cli, and
You are a Claude agent, built on Anthropic's Claude Agent SDK. for sdk-*.
A client’s own SDK identity, including the running within the Claude Agent SDK
variant, is kept. An identity block of the other kind is rewritten, and one is
inserted when the client sent none. With the switch off, the client’s system
blocks are left as sent.
The billing checksum (cch), the cc_version suffix and metadata.user_id
are computed the same way for both identities. Anthropic may meter Agent SDK
traffic on a subscription separately from interactive use; the entrypoint is
what it reads to tell them apart.
Antigravity identity
Theantigravity channel always presents as the Antigravity hub (the
antigravity --hub process the IDE runs): the hub’s user agent, userAgent,
requestId, labels and sessionId.
agent_kind selects which of the hub’s agents a generation request presents
as. A requestType the client already put in the envelope is kept.
custom_agent(default): A Markdown custom agent whose frontmatter setsexcludeDefaultComponents: true.requestTypeiscustom_agent, and the system instruction is only the client’s own prompt, enclosed in<System Prompt>tags, with no Antigravity identity. The CLI imports Claude Code subagents the same way, keeping the body as the prompt, so any client’s prompt fits this shape.antigravity: The built-in agent.requestTypeisagent, and the hub’s identity block,<identity>You are Antigravity, a powerful agentic AI coding assistant …</identity>, opens the system instruction, as CLI 1.5.20 renders itsantigravity_identitytemplate. It is not added when the system instruction already carries that identity.
<USER_REQUEST> tags;
tool-result turns and text that already carries the tags are left alone. The
hub’s <ADDITIONAL_METADATA> local time is not added. These shapes come from
an offline capture of CLI 1.5.20 (2026-12-01).
The body is also spelled the way the hub spells it, without changing what it
asks:
- Claude Code’s
x-anthropic-billing-header:line is removed from the system instruction. - The system instruction is written as
systemInstructionwithrole: "user"; several plain-text parts are joined into one, a line apart, and blank parts are dropped. typein a tool declaration’sparametersis upper-cased (OBJECT,STRING).parametersJsonSchemais JSON Schema and keeps lower case.
Per-operation URL overrides
operation_endpoints replaces the complete method URL for one
(operation, dialect, transport) on one provider. The URL is used as given;
it is not a base URL with the channel’s default path appended. The channel
resolves its own path parameters for that method:
{model} in the URL is replaced
with the upstream model name, percent-encoded as a single path segment:
https://relay.example/v1beta/models/{model}:generateContent.
operation_rules overrides, per provider, what the channel does for an
operation. Channel defaults stay in code and are not copied into each new
provider, so a provider without overrides follows later changes to the
defaults. POST /admin/api/providers/{id}/routing-defaults/reset removes both
kinds of override in one commit.
Gemini Interactions
Theaistudio channel speaks two Gemini dialects: gemini (GenerateContent)
and gemini_interactions (the Interactions API). Both serve the
generate_content and stream_generate_content operations, but Interactions
has its own request shape, step events and response type.
Clients call POST /v1beta/interactions or POST /v1/interactions, with or
without a provider mount in front. stream: true gives native SSE.
GET /interactions/{id}, POST /interactions/{id}/cancel and
DELETE /interactions/{id} take the same version prefix, and query parameters
such as stream and last_event_id are passed through so that a client can
retrieve or resume a stream. An interaction id, and any
previous_interaction_id that refers to it, is only valid for the gateway
caller that created it and stays on the credential that created it. An
agent target goes through model routing and permission checks like a model
name, and the agent field is kept on the upstream request.
Responses, Chat Completions and Claude Messages convert to and from
Interactions directly, without stored state. To use it, set
gemini_interactions as the target dialect in the provider’s operation
mappings, or create a custom provider that speaks only Interactions:
store: true. When an Interactions client is converted to a
different upstream, send the full history with store: false; the response
id it gets back does not name an interaction stored upstream.
Native streaming is incremental. A stream that crosses protocols is collected
in full from the upstream first and then replayed as the client’s events, so
it does not shorten the time to the first token. Polling and resumed
retrieval do not bill the cumulative usage a second time. Background work
whose creation response carries no usage is not reported by the gateway.
Decisions
Theopenai channel serves OpenAI Decisions (POST /v1/decisions) and the
aistudio channel serves Gemini Decisions (POST /v1beta/decisions). Either
client can be routed to either upstream; the request and the answers are
converted, and the probabilities are those of the upstream model that
answered.
An OpenAI client on a Gemini upstream:
- Questions keep their order and names. A question with no name, or a name Gemini cannot use as a key, is sent under a placeholder and answered under its original name.
- Boolean choice values are sent as text and returned as booleans.
- A score level’s
labelanddescriptionare sent as one description. - Messages other than user messages, and tool calls with their outputs, are written out as text, because Gemini Decisions takes no conversation history.
- Images in question instructions are refused. Prompt-cache fields are dropped.
- The
criteriaof a yes/no question are appended to its instructions. - Audio, video and document input, more than 10 score levels, and more than 400 questions are refused.
- If the upstream refuses to answer one question, the whole request fails, because a Gemini answer has no refusal type.
GLM
glm is the pay-as-you-go API and glmcode the GLM Coding Plan. Both take an
api_key credential and default to https://open.bigmodel.cn; global
accounts set baseUrl: "https://api.z.ai". glmcode uses the plan’s
dedicated Chat, Claude Messages and Responses endpoints and does not fall back
to paid API usage when the plan is exhausted.
Both model lists come from ZCode’s live official catalogue: the channel
requests /api/v1/client/configs, downloads the returned
builtin_provider_config_json, and selects the regional platform API or
Coding Plan template. There is no bundled model list and no fallback to a
stale list if the download fails. The catalogue is the vendor’s product list;
it does not prove that a given key may use every model in it.
glmcode reads /api/monitor/usage/quota/limit for the reported percentages,
the independent windows and their reset times. Platform glm does not yet
query the account balance.
MiniMax
minimax defaults to https://api.minimax.io; accounts on the Chinese
platform set that platform’s API origin. OpenAI Chat and Claude Messages accept
either a Subscription Key (Coding Plan / Token Plan) or a pay-as-you-go API key
in api_key. Model discovery and model details use the official /v1/models
and /v1/models/{id} endpoints. You can put the two kinds of key on separate
providers to route subscription text and paid video independently.
Following the official CLI, the quota query reads /v1/token_plan/remains or
/account/query_balance depending on the key type. The readings (and those
of glmcode) are for display; whether a credential is exhausted is decided by
the upstream’s responses.
Video covers H3 V2 (MiniMax-H3, MiniMax-H3-Max) and requires a
pay-as-you-go API key. Submit GPROXY’s OpenAI video extension JSON to
/v1/videos:
/v1/videos/{id} with the returned ID and download the finished video
from /v1/videos/{id}/content. frame_images sets first and last frames;
input_references supplies image, video and audio references. MiniMax’s
native content is accepted too. Sora multipart, seconds, size and the
legacy Hailuo 2.x V1 endpoints are not supported.
Listing uses page_num and page_size (limit maps to page_size); the
after and order cursors are not supported. Deletion reports the upstream’s
action: cancelled means a queued task was cancelled, deleted that a task
record was removed. The channel does not poll on its own and does not store
video files.
Sources: ZCode catalogue implementation, MiniMax official CLI, GLM Coding Plan, MiniMax text, MiniMax H3 V2.
OrcaTerm
orcaterm speaks the desktop LightAI protocol for text and image
conversations, with model-specific thinking settings. Create the provider,
then sign in through the browser or import an OAuth credential. Set
international=true for the international service; its account origin is
https://orcaterm.ai and its LightAI origin https://lightai.tencentcloud.com.
Images are sent as Base64 data URLs (PNG, JPEG, WebP or GIF), including images
in history and user messages that contain only an image. Oversized static
images are resized and compressed before upload, and an identical image reuses
the credential’s earlier upload while its preview URL is still valid. The
available models and thinking levels come from the live model catalogue.
Request options the upstream does not support are ignored. Token counts are
local character estimates, marked as estimated and partial in metering; the
account quota reports AI question counts.
The client’s terminal, file and web-fetch tools, where GPROXY recognises them,
are mapped onto OrcaTerm’s native review/reportToolResult protocol. The
original client still executes each call under its own permission checks.
Tool continuations use the same provider, credential and model; registering
arbitrary functions is not supported. Answer text and tool arguments are
released after the agent has finished revising its response. Standalone web
requests from Codex use OrcaTerm’s server-side search and fetch tools and
return their real results.
Volcengine Ark
volcengine_agent (Agent Plan) and volcengine_coding (Coding Plan) share
one implementation and use the products’ own paths (/api/plan and
/api/coding); they never fall back to the pay-as-you-go /api/v3 endpoint.
Agent Plan needs its dedicated API key. Coding Plan personal uses a platform
API key with Coding Plan enabled; Coding Plan enterprise uses its seat API key.
Inference needs only {"api_key"}. Model discovery, quota and plan
information also need an IAM key pair in the same secret
(access_key_id, secret_access_key, optionally session_token). The key
pair is sent only to the control plane, and the API key only to inference.
Without the key pair, inference still works with manually configured model
rows.
config.edition is personal (default) or enterprise; enterprise quota
needs seat_id in the credential’s metadata. The origins can be overridden
with the provider’s base URL (default https://ark.cn-beijing.volces.com),
config.control_base_url (https://ark.cn-beijing.volcengineapi.com) and,
for Agent Plan speech, config.speech_base_url
(https://openspeech.bytedance.com). Agent credentials can set metadata
allow_paid_usage: true to keep routing past the subscription windows when
the account has postpaid usage enabled upstream.
Credentials
A credential is one secret in a provider’s pool: an API key, an OAuth token set, or a browser session. In the Console, open the provider and use its Credentials tab; through the API,POST /admin/api/credentials creates
one, and its batch endpoint creates several.
Secrets are sealed with AES-256-GCM under the master key. The seal is bound to
the row’s own id, so a sealed blob copied onto another row cannot be opened.
Reading a secret back is a separate call, and it is audited:
Credential visibility
A credential is visible to a caller when it has no owner, or when its owner matches the binding of the calling key: the key’s own user, team, or effective organization. The key’s binding is used rather than the user’s memberships because a user can belong to two organizations while a key belongs to one. If membership decided, every key of a user in several organizations would reach every one of those organizations’ subscriptions, and no key could be narrower than its holder. Visibility only removes credentials from the set a request may use; it never adds any.Logging in to obtain a credential
Channels that hold an account rather than a key let you create the credential by signing in to the upstream.- Open the provider’s Credentials tab and choose Add by signing in.
- For a browser (authorization code) login, open the authorization link, sign in, and paste the full callback URL from the browser’s address bar back into the dialog.
- For a device-code login, enter the displayed code on the vendor’s page; the Console polls until the login completes.
loginModes in
GET /admin/api/channels. Requesting a mode the channel does not offer is
refused.
Some channels also list loginVariants: named choices inside those flows,
each with an id, a label and the mode it runs. Kiro lists github and
google (device code) and aws (authorization code, Builder ID or IAM
Identity Center). Pass the chosen id as variant in the start request.
Without it the channel uses its provider configuration.
The four POST operations live under
/admin/api/credential-login. The pending
login is bound to the user who started it and to that user’s administrative
scope.
Importing an existing credential
If you already have the token or cookie, import it withPOST /admin/api/credentials (or the batch endpoint) and initialise it with
POST /admin/api/credentials/{id}/refresh. The Console refreshes pending
imports after saving; if initialisation fails, the saved row stays and you can
retry from its details. Claude Web uses authKind: "cookie"; Claude Code and
OrcaTerm use authKind: "oauth", including imports given as
secret: {"cookie": "..."}. Older kind labels are still read. Initialisation
and refresh store the secret, the expiry and optional public metadata together
under the version check, so no database migration or backfill is involved.
How a login is protected
GPROXY generates and checks everything that is not the upstream’s business. The PKCE verifier is 32 random bytes generated locally and never sent; only its S256 digest goes into the authorize URL, so an intercepted code is useless without it. The CSRF state is also generated and compared locally. A state that does not match is refused and destroys the pending session, so a replay cannot be retried until it succeeds. The pending session is kept in the shared cache, not in the process. Any instance can therefore finish a login another instance started (behind a load balancer that is the usual case), and an abandoned login leaves nothing behind: its key expires, and an expired key looks the same as one that was never issued. A device poll performs one step and returns; the server does not sleep or loop, and the caller does the polling. Each answer carries the interval to wait, and an upstreamslow_down raises it for all later polls.
A successful login is an ordinary credential insert through the same commit
path a management write uses. The secret is sealed before the statement is
built, so nothing between the channel and the database sees it in clear, and
the answer contains only the new credential’s id.
Refreshing a credential
Channels that hold OAuth tokens declare when a secret is due. A refresh returns a complete replacement secret, not a partial update to merge. The host writes it with a compare-and-swap onversion and publishes a credential-changed
notice. To refresh by hand:
invalid_grant, a
revoked token), the credential is marked dead. A transient transport error or
a 5xx does not mark it dead; it is reported as a transport error and the host
retries later.
The version check matters because Claude rotates the refresh token on every
refresh. If two refreshes raced and one write were lost, the stored refresh
token would already be invalid.
Credential health and quota windows
When a request is resolved, disabled, retired and dead credentials are left out. A blocked credential, one the upstream has rate-limited, is left out while its provider still has an unblocked one. If every credential of a provider is blocked, they are kept, and the provider is ordered after all healthy providers, so that it is tried only when nothing else is available. The admin API reports and resets this state per credential:POST /admin/api/credentials/{id}/status sets active or dead by hand,
with a reason.
Connection profiles
A connection profile is the outbound stack a call uses: the proxy, and the TLS and HTTP/2 identity it presents. The profile is chosen from the credential first, then the provider, then the channel’s own default, then the instance default. The identity presets can be stored as a profile’semulation:
wreq:{profile} preset for each browser and HTTP
client profile the emulation library ships (Chrome, Edge, Firefox, Safari,
Opera, OkHttp).
Only the wreq transport presents an emulated identity. A channel that
impersonates a CLI supplies its own default profile; an explicit profile on
the credential or the provider still takes precedence.
Testing a provider
Two kinds of management call reach outside the process: the connectivity test and the model test with discovery.Connectivity test
The connectivity test asks Cloudflare’s trace endpoint how this deployment looks from outside, through the client chain the scope selects:global, {"scope":"provider","provider_id":"…"},
{"scope":"credential","credential_id":"…"} (the same transport that
credential’s calls use), or {"scope":"proxy","url":"…"} for a proxy that is
not configured anywhere yet. A network failure is reported as ok: false with
a reason, not as an HTTP error, since an unreachable upstream is a valid
result of the test.
Model test and discovery
Model test and discovery run through the engine in the same way as a caller’s request:POST /admin/api/models/discover/apply inserts the models you select and
skips those that already exist.
Request header allow-lists
By default, client request headers are not forwarded upstream. Settings → Network holds the global request-header allow-list, and each provider can add names withconfig.allowed_headers. The effective set is the union of the
global list, the provider’s list and the channel’s defaults, plus
content-type. A missing or empty list adds nothing.
Source credentials and hop-by-hop headers are removed even when listed.
Authentication the channel injects and the static headers in config are
not affected by this policy. Changes take effect on the next configuration
reload; the provider’s saved list is not rewritten with the merged result.