跳到正文

Sign in to 开桥 with OAuth PKCE ​

开桥 supports connecting local agents through OAuth 2.0 Authorization Code + PKCE. This flow does not require you to create, copy, or store a 开桥 API key. The agent opens a browser for authorization, uses a short-lived access token for model requests, and refreshes the token before it expires.

The following agents are currently supported:

AgentPlugin / installation sourceSign-in entry point
OpenClaw@openqiao/openclaw-pluginopenclaw models auth login --provider openqiao
Codex CLI / Codex App@openqiao/codex-oauthopenqiao-codex-auth login
DeepSeek Harness (DSH Web)@openqiao/dsh-plugins/openqiao login
OpenCode@openqiao/opencode-oauth/connect or opencode auth login
Pi@openqiao/pi-openqiao-oauth/login openqiao
Hermes AgentGitHub: 开桥/hermes-plugin; PyPI: openqiao-hermes-pluginhermes auth add openqiao

Register a new OAuth client

OAuth clients are currently registered by the 开桥 backend. To register a client for a new agent or application, email support@openqiao.com with the application name, project or package URL, redirect URI, requested scopes, and contact information.

OAuth PKCE versus API keys

OAuth PKCE authorization is tied to your 开桥 user and an authorization grant. It does not distribute a client secret to the plugin and does not require writing an API key into your shell configuration. You can revoke access at any time from 开桥 Authorized Apps.

Authorization flow ​

These integrations follow the same core flow:

  1. The agent generates a one-time PKCE code_verifier and its S256 code_challenge.
  2. A browser opens the 开桥 authorization page, where you confirm the account and requested access.
  3. 开桥 returns a one-time authorization code to a temporary callback port on 127.0.0.1.
  4. The plugin exchanges the authorization code and code_verifier for an access token and refresh token.
  5. The agent uses the access token for 开桥 requests and refreshes it before expiration.

The official packages request only these scopes by default:

  • inference:invoke: invoke models.
  • offline_access: refresh the sign-in session after the access token expires.

OpenClaw ​

Install the plugin and start sign-in:

bash
openclaw plugins install @openqiao/openclaw-plugin
openclaw models auth login --provider openqiao

Select 开桥 OAuth, finish authorization in the browser, and then choose a openqiao/... model in OpenClaw.

OpenClaw stores tokens in its own authentication profile store and persists rotated refresh tokens automatically. Models are discovered dynamically, with the latest valid catalog cached at ~/.cache/openclaw/openqiao/models.json.

Remote servers and VPS hosts

OpenClaw supports copying the full final redirect URL from the browser back into the terminal, allowing sign-in when OpenClaw runs on a remote server.

Codex CLI and Codex App ​

Install the authentication tool globally:

bash
npm install -g @openqiao/codex-oauth

Configure Codex and sign in:

bash
openqiao-codex-auth install
openqiao-codex-auth login

Restart Codex CLI or Codex App afterward. install configures 开桥 as a Responses provider and downloads the current Responses-compatible model catalog without changing your existing model name. An existing ~/.codex/config.toml is backed up first.

Inspect or clear the sign-in state with:

bash
openqiao-codex-auth status
openqiao-codex-auth logout

Do not run the token command manually

openqiao-codex-auth token is intended exclusively for Codex auth.command calls and prints a live Bearer token to standard output. Do not run, capture, or screenshot it for debugging.

To remove the integration completely, restore the Codex configuration before uninstalling the npm package:

bash
openqiao-codex-auth uninstall
npm uninstall -g @openqiao/codex-oauth

DeepSeek Harness ​

For complete installation, proxy, and model configuration details, see DeepSeek Harness Integration.

Install the 开桥 bundle into the DSH Web profile, then start DSH:

bash
dsh plugin --profile web add @openqiao/dsh-plugins
dsh web

Run this command in DSH Web:

text
/openqiao login

After browser authorization displays 开桥 connected, return to DSH and select 开桥 · DeepSeek V4 Pro or 开桥 · DeepSeek V4 Flash from the model selector.

Manage the sign-in state with:

text
/openqiao status
/openqiao logout

DSH support scope

The current package targets interactive DSH Web deployments that can execute /openqiao commands. Pure headless or automated deployments that do not consume command adapters cannot initiate browser sign-in, although they can reuse credentials created under the same Harness home.

OpenCode ​

Add the OAuth package to your OpenCode configuration:

json
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@openqiao/opencode-oauth"]
}

Then run:

bash
opencode auth login -p openqiao -m "开桥 OAuth (PKCE)"

Alternatively, run /connect in OpenCode, select 开桥, and choose 开桥 OAuth (PKCE). After authorization, run /models and select a 开桥 model.

OpenCode keeps access and refresh tokens in its own credential store. The catalog maps each model to Anthropic Messages, OpenAI Responses, or Chat Completions and is cached at ~/.cache/opencode/openqiao/models.json.

Version compatibility

@openqiao/opencode-oauth currently targets the stable OpenCode V1 plugin API. OpenCode V2 uses a separate beta plugin API and is outside the support scope of this guide.

Pi ​

Install the extension with Pi:

bash
pi install npm:@openqiao/pi-openqiao-oauth

After starting Pi, sign in with:

text
/login openqiao

When browser authorization finishes, return to Pi, run /model, and select a 开桥 model. Pi manages access and refresh tokens through its provider credential store and caches the model catalog at ~/.pi/agent/models-store.json.

Hermes Agent ​

For complete installation, default provider configuration, remote authorization, and troubleshooting, see Hermes Agent Integration. Source code and alternative installation methods are available at 开桥/hermes-plugin.

Hermes version requirement

Hermes must include the declarative OAuth PKCE plugin API (main must include commit 3e67877e1b or later). Update older Hermes installations first. This is not an npm package: installing from GitHub through Hermes is recommended, or install the PyPI package openqiao-hermes-plugin in the same Python 3.11+ environment as Hermes.

Install and enable the plugin:

bash
hermes plugins install 开桥/hermes-plugin --enable
hermes gateway restart

If no Gateway is running, restart Hermes instead. Restart Gateways managed by PM2 or another process manager through that manager.

Sign in and check status:

bash
hermes auth add openqiao
hermes auth status openqiao

On the 开桥 authorization page, select your account and billing option, then approve access. OAuth avoids manually creating an API Key, but model requests are still billed to the selected account and billing option.

After authorization, run hermes model and select the plugin's 开桥 provider and a model, or specify them explicitly:

bash
hermes --provider openqiao -m google/gemini-2.5-flash-lite

Send a test message and confirm that the model responds. openqiao is the provider name; use the full vendor/model slug without adding a openqiao/ prefix. When migrating from an API Key custom endpoint, switch the provider from custom to openqiao rather than only replacing credentials.

Hermes stores access and refresh tokens in its credential pool and serializes refresh token rotation through credential locks. The plugin reads the live model catalog and filters image-only and video-only generation models. Valid unlisted slugs require Hermes support for ProviderProfile.model_listing_authoritative; API permissions and responses remain authoritative.

Manage authentication with:

bash
hermes auth list openqiao
hermes auth refresh openqiao
hermes auth logout openqiao

Remote servers and headless environments

Run hermes auth add openqiao --no-browser in the remote terminal. Forward the callback port printed for that login over SSH from your local machine, then open the current authorization URL in your local browser. Do not reuse old URLs or a fixed example port. Plugin version 0.1.1 and later waits up to 10 minutes. See Remote authorization for detailed steps.

Credential storage and security ​

AgentCredential storage
OpenClawOpenClaw authentication profile store
CodexmacOS Keychain; other systems use ~/.config/openqiao/codex-oauth/credentials.json with mode 0600
DeepSeek HarnessDSH ctx.credentials service
OpenCodeOpenCode credential store
PiPi provider credential store
Hermes AgentHermes credential pool (credential_pool.openqiao in auth.json), not the plugin directory
  • Production uses bundled native public client IDs. No client secret is stored in the plugin packages.
  • Callback listeners bind only to temporary ports on 127.0.0.1 and validate OAuth state.
  • Access tokens are refreshed before expiration. When the server rotates a refresh token, the plugin saves the replacement.
  • Never copy OAuth tokens into model settings, environment variables, logs, or screenshots.
  • When you stop using an agent, sign out from the agent and revoke its grant from 开桥 Authorized Apps.

Troubleshooting ​

The browser does not open automatically ​

Copy the authorization URL printed in the terminal into a browser. For Codex, you can also set:

bash
export OPENQIAO_OAUTH_NO_BROWSER=1
openqiao-codex-auth login

The terminal keeps waiting after browser authorization ​

The OAuth callback uses a temporary port on 127.0.0.1. Confirm that a firewall is not blocking loopback connections and that the authorization browser can reach the callback on the machine running the agent. In remote or container environments, the browser's 127.0.0.1 is not necessarily the agent host. OpenClaw supports pasting the full redirect URL back into the terminal. For Hermes, use --no-browser and forward the actual callback port for the current login; see Remote authorization.

Sign-in succeeds, but 开桥 models are missing ​

Reopen the agent's model selector and confirm that the model catalog endpoint is reachable. OpenClaw, OpenCode, and Pi preserve the last valid catalog cache. DeepSeek Harness currently provides two bundled model entries. Codex writes its catalog during openqiao-codex-auth install; run that command again after the production catalog changes.

Hermes uses the live catalog rather than the disk catalog caches described above. For Unknown provider, run hermes plugins list to confirm installation and enablement, then restart Hermes / Gateway. If a valid unlisted slug is rejected, update Hermes and the plugin; see Hermes troubleshooting.