opencode-trae-cli-auth
v0.1.1
Published
opencode provider plugin that proxies models through the local Trae CLI
Maintainers
Readme
opencode-trae-cli-auth
An opencode provider plugin that proxies model calls through your local traecli login.
It is useful when Trae CLI already works locally and you want to use the same account/models from opencode.
Features
- Adds a
traeprovider to opencode. - Uses the local
traeclibinary and existing Trae login; no API key is stored by this package. - Exposes common Trae cloud models, including
GLM-5.1,Doubao-Seed-2.0-Code,DeepSeek-V3.2,Qwen3-Coder-Next, and more. - Reads the current model from
~/.trae/trae_cli.yaml/~/.trae/traecli.yamlwhen available. - Supports local
file://plugin installs for development.
Prerequisites
- Node.js >= 20
- opencode >= 1.14
traecliinstalled and logged in
Verify Trae CLI first:
traecli "reply with 'ok'" -p --jsonIf this command fails, fix Trae CLI login/config before using this plugin.
Install
From npm:
opencode plugin opencode-trae-cli-authFor local development from this repository:
npm install
npm run build
opencode plugin file:///absolute/path/to/opencode-trae-cli-auth/dist/index.jsYou can also add it manually to an opencode config:
{
"plugin": [
"opencode-trae-cli-auth"
],
"model": "trae/GLM-5.1"
}Local file example:
{
"plugin": [
"file:///Users/you/dev/opencode-trae-cli-auth/dist/index.js"
],
"model": "trae/GLM-5.1"
}Models
List models after installing:
opencode models traeBuilt-in model ids currently include:
trae/defaulttrae/Doubao-Seed-2.0-Codetrae/Doubao-Seed-Codetrae/GLM-5.1trae/GLM-5trae/GLM-4.7trae/MiniMax-M2.7trae/MiniMax-M2.5trae/Qwen3-Coder-Nexttrae/Kimi-K2.6trae/Kimi-K2.5trae/DeepSeek-V3.2trae/DeepSeek-V3.1-Terminus
trae/default does not pass model.name and uses the default model selected in Trae CLI.
Other model ids are passed to Trae CLI as:
--config model.name=<model-id>Usage
opencode run --model trae/GLM-5.1 "reply with 'ok'"Options
When loading the plugin programmatically, the plugin accepts:
type TraePluginOptions = {
cliPath?: string
modelName?: string
queryTimeout?: number
extraArgs?: string[]
sessionId?: string
}cliPath: override thetraeclibinary path.modelName: force a Traemodel.nameregardless of opencode model id.queryTimeout: timeout in seconds fortraecli --query-timeout.extraArgs: extra arguments appended totraecli.sessionId: optional session id; not passed by default because some Trae CLI versions crash with explicit session ids.
Known limitations
- Tool calls are not supported yet; models are advertised with
tool_call: false. - Usage/token counts may be zero when Trae CLI does not emit usage metadata.
- Trae CLI may print
keyring is not supported on this system; this is a Trae CLI environment warning and usually does not prevent responses.
Development
npm install
npm test
npm run build
npm pack --dry-runLicense
MIT
