opencode: fix invalid config and externalize the bailian key

opencode rejected the config with "Unrecognized key: providers". The
file had both `provider` (opencode's schema: npm + options) and
`providers` (package: "aisdk:..." + settings, some other tool's shape,
left behind by an api-for-cursor script back in July). The Alibaba/Qwen
provider lived only under the rejected key, so it had never actually
reached opencode.

Translate it into the real schema -- package -> npm, settings -> options
at both provider and model level -- rather than dropping it, so those
five qwen models now work. The duplicate cursorapi under `providers` is
dropped: the existing provider.cursorapi is a superset, with four models
plus cost and limit metadata.

The 113-char bailian key moves to secrets/bailian-api-key (0600) and is
referenced as {file:./secrets/bailian-api-key}, which opencode resolves
relative to the config dir -- so no absolute home path, and no shell
export needed on ssh-only boxes. Verified by pointing it at a missing
file and getting "bad file reference".

With the key out, opencode.json can finally be tracked. Ignore the
secrets dir, the stale .bak copies that still contain it, and the
node/bun lockfiles.
This commit is contained in:
Anton Volnuhin 2026-08-06 02:53:27 +03:00
parent a84778a640
commit 2ba14d3e6d
2 changed files with 177 additions and 0 deletions

View File

@ -40,6 +40,13 @@ Library
.reasonix/.env .reasonix/.env
.reasonix/sessions .reasonix/sessions
.reasonix/projects .reasonix/projects
.config/opencode/secrets
.config/opencode/*.bak
.config/opencode/*.bak.*
.config/opencode/*backup*
.config/opencode/node_modules
.config/opencode/bun.lock
.config/opencode/package-lock.json
# kitty: the light/dark mode is per-machine, and the *-theme.auto.conf files # kitty: the light/dark mode is per-machine, and the *-theme.auto.conf files
# are generated from it plus .config/kitty/themes. Tracking them would make # are generated from it plus .config/kitty/themes. Tracking them would make

View File

@ -0,0 +1,170 @@
{
"$schema": "https://opencode.ai/config.json",
"model": "cursorapi/composer-2.5-fast",
"provider": {
"cursorapi": {
"models": {
"composer-2.5": {
"cost": {
"input": 0.5,
"output": 2.5
},
"limit": {
"context": 200000,
"output": 65536
},
"name": "Composer 2.5"
},
"composer-2.5-fast": {
"cost": {
"input": 3,
"output": 15
},
"limit": {
"context": 200000,
"output": 65536
},
"name": "Composer 2.5 Fast"
},
"grok-4.5": {
"cost": {
"input": 2,
"output": 6
},
"limit": {
"context": 200000,
"output": 65536
},
"name": "Grok 4.5"
},
"grok-4.5-fast": {
"cost": {
"input": 4,
"output": 18
},
"limit": {
"context": 200000,
"output": 65536
},
"name": "Grok 4.5 Fast"
}
},
"name": "API for Cursor",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "cursor-local",
"baseURL": "http://127.0.0.1:8788/v1"
}
},
"bailian-token-plan-personal": {
"models": {
"qwen3.6-flash": {
"capabilities": {
"input": [
"text",
"image"
],
"output": [
"text"
],
"tools": true
},
"name": "Qwen3.6 Flash",
"options": {
"thinking": {
"budgetTokens": 8192,
"type": "enabled"
}
}
},
"qwen3.6-plus": {
"capabilities": {
"input": [
"text",
"image"
],
"output": [
"text"
],
"tools": true
},
"name": "Qwen3.6 Plus",
"options": {
"thinking": {
"budgetTokens": 8192,
"type": "enabled"
}
}
},
"qwen3.7-max": {
"capabilities": {
"input": [
"text"
],
"output": [
"text"
],
"tools": true
},
"name": "Qwen3.7 Max",
"options": {
"thinking": {
"budgetTokens": 8192,
"type": "enabled"
}
}
},
"qwen3.7-plus": {
"capabilities": {
"input": [
"text",
"image"
],
"output": [
"text"
],
"tools": true
},
"name": "Qwen3.7 Plus",
"options": {
"thinking": {
"budgetTokens": 8192,
"type": "enabled"
}
}
},
"qwen3.8-max-preview": {
"body": {
"temperature": 0.6
},
"capabilities": {
"input": [
"text"
],
"output": [
"text"
],
"tools": true
},
"limit": {
"context": 983616,
"output": 131072
},
"name": "Qwen3.8 Max Preview",
"options": {
"thinking": {
"budgetTokens": 99072,
"type": "enabled"
}
}
}
},
"name": "Alibaba Cloud Model Studio",
"npm": "@ai-sdk/anthropic",
"options": {
"apiKey": "{file:./secrets/bailian-api-key}",
"baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1"
}
}
}
}