Sign in to OpenQiao with OAuth PKCE
OpenQiao supports connecting local agents through OAuth 2.0 Authorization Code + PKCE. This flow does not require you to create, copy, or store a OpenQiao 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:
| Agent | Plugin / installation source | Sign-in entry point |
|---|---|---|
| OpenClaw | @openqiao/openclaw-plugin | openclaw models auth login --provider openqiao |
| Codex CLI / Codex App | @openqiao/codex-oauth | openqiao-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 Agent | GitHub: OpenQiao/hermes-plugin; PyPI: openqiao-hermes-plugin | hermes auth add openqiao |
Register a new OAuth client
OAuth clients are currently registered by the OpenQiao 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 OpenQiao 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 OpenQiao Authorized Apps.
Authorization flow
These integrations follow the same core flow:
- The agent generates a one-time PKCE
code_verifierand its S256code_challenge. - A browser opens the OpenQiao authorization page, where you confirm the account and requested access.
- OpenQiao returns a one-time authorization code to a temporary callback port on
127.0.0.1. - The plugin exchanges the authorization code and
code_verifierfor an access token and refresh token. - The agent uses the access token for OpenQiao 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:
openclaw plugins install @openqiao/openclaw-plugin
openclaw models auth login --provider openqiaoSelect OpenQiao 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:
npm install -g @openqiao/codex-oauthConfigure Codex and sign in:
openqiao-codex-auth install
openqiao-codex-auth loginRestart Codex CLI or Codex App afterward. install configures OpenQiao 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:
openqiao-codex-auth status
openqiao-codex-auth logoutDo 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:
openqiao-codex-auth uninstall
npm uninstall -g @openqiao/codex-oauthDeepSeek Harness
For complete installation, proxy, and model configuration details, see DeepSeek Harness Integration.
Install the OpenQiao bundle into the DSH Web profile, then start DSH:
dsh plugin --profile web add @openqiao/dsh-plugins
dsh webRun this command in DSH Web:
/openqiao loginAfter browser authorization displays OpenQiao connected, return to DSH and select OpenQiao · DeepSeek V4 Pro or OpenQiao · DeepSeek V4 Flash from the model selector.
Manage the sign-in state with:
/openqiao status
/openqiao logoutDSH 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:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@openqiao/opencode-oauth"]
}Then run:
opencode auth login -p openqiao -m "OpenQiao OAuth (PKCE)"Alternatively, run /connect in OpenCode, select OpenQiao, and choose OpenQiao OAuth (PKCE). After authorization, run /models and select a OpenQiao 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:
pi install npm:@openqiao/pi-openqiao-oauthAfter starting Pi, sign in with:
/login openqiaoWhen browser authorization finishes, return to Pi, run /model, and select a OpenQiao 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 OpenQiao/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:
hermes plugins install OpenQiao/hermes-plugin --enable
hermes gateway restartIf no Gateway is running, restart Hermes instead. Restart Gateways managed by PM2 or another process manager through that manager.
Sign in and check status:
hermes auth add openqiao
hermes auth status openqiaoOn the OpenQiao 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 OpenQiao provider and a model, or specify them explicitly:
hermes --provider openqiao -m google/gemini-2.5-flash-liteSend 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:
hermes auth list openqiao
hermes auth refresh openqiao
hermes auth logout openqiaoRemote 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
| Agent | Credential storage |
|---|---|
| OpenClaw | OpenClaw authentication profile store |
| Codex | macOS Keychain; other systems use ~/.config/openqiao/codex-oauth/credentials.json with mode 0600 |
| DeepSeek Harness | DSH ctx.credentials service |
| OpenCode | OpenCode credential store |
| Pi | Pi provider credential store |
| Hermes Agent | Hermes 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.1and validate OAuthstate. - 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 OpenQiao 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:
export OPENQIAO_OAUTH_NO_BROWSER=1
openqiao-codex-auth loginThe 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 OpenQiao 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.