anomalyco / anomalyco/opencode
Can't use custom provider
Open
@rekram1-node is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
I don't know im stupid or this is a bug. This is my provider config:
"provider": {
"custom_openai": {
"npm": "@ai-sdk/openai-compatible",
"name": "Custom OpenAI Compatible",
"options": {
"baseURL": "{env:OPENAI_API_BASE}",
"apiKey": "{env:OPENAI_API_KEY}"
}
}
}
When i run opencode normaly it automaticaly uses normal openai provider. i think because of the environment variable names. But i cant see my provider on /connect menu. I also tried from shell:
$ opencode run -m custom_openai/glm-5.2 "test" --print-logs
timestamp=2026-08-07T16:53:15.114Z level=INFO run=39eeb06f message="creating instance" directory=/home/melon
timestamp=2026-08-07T16:53:15.127Z level=INFO run=39eeb06f message=fromDirectory directory=/home/melon
timestamp=2026-08-07T16:53:15.228Z level=INFO run=39eeb06f message=bootstrapping directory=/home/melon
timestamp=2026-08-07T16:53:15.258Z level=INFO run=39eeb06f message=loading path=/home/melon/.config/opencode/config.json
timestamp=2026-08-07T16:53:15.295Z level=INFO run=39eeb06f message=loading path=/home/melon/.config/opencode/opencode.json
timestamp=2026-08-07T16:53:15.318Z level=INFO run=39eeb06f message=loading path=/home/melon/.config/opencode/opencode.jsonc
timestamp=2026-08-07T16:53:16.135Z level=INFO run=39eeb06f message="all LSPs are disabled"
timestamp=2026-08-07T16:53:16.144Z level=INFO run=39eeb06f message="all formatters are disabled"
timestamp=2026-08-07T16:53:16.145Z level=INFO run=39eeb06f message=init
timestamp=2026-08-07T16:53:17.202Z level=INFO run=39eeb06f message=created id=ses_022db4eeeffexfWGxjmWmgxRck slug=calm-lagoon version=1.18.14 projectID=global directory=/home/melon path=home/melon workspaceID=undefined parentID=undefined title="New session - 2026-08-07T16:53:17.202Z" agent=undefined model=undefined metadata=undefined permission="[{\"permission\":\"question\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"plan_enter\",\"pattern\":\"*\",\"action\":\"deny\"},{\"permission\":\"plan_exit\",\"pattern\":\"*\",\"action\":\"deny\"}]" cost=0 tokens.input=0 tokens.output=0 tokens.reasoning=0 tokens.cache.read=0 tokens.cache.write=0 time.created=1786121597202 time.updated=1786121597202
timestamp=2026-08-07T16:53:17.278Z level=INFO run=39eeb06f message="event connected"
timestamp=2026-08-07T16:53:20.653Z level=ERROR run=39eeb06f message="share subscriber failed" type=message.updated cause="Cause([Fail(ProviderModelNotFoundError: Model not found: custom_openai/glm-5.2.)])"
timestamp=2026-08-07T16:53:20.727Z level=INFO run=39eeb06f message=loop session.id=ses_022db4eeeffexfWGxjmWmgxRck step=0
timestamp=2026-08-07T16:53:20.757Z level=ERROR run=39eeb06f message=failed ref=err_baef6656 error="ProviderModelNotFoundError: Model not found: custom_openai/glm-5.2." cause="ProviderModelNotFoundError: Model not found: custom_openai/glm-5.2.\n at <anonymous> (/$bunfs/root/chunk-9nhdzdbs.js:439:89847)\n at SessionPrompt.getModel (/$bunfs/root/chunk-nfqtvcwx.js:1085:11482)\n at SessionPrompt.getModel (definition) (/$bunfs/root/chunk-nfqtvcwx.js:1085:908)\n at SessionPrompt.run (/$bunfs/root/chunk-nfqtvcwx.js:1085:15298)\n at SessionPrompt.run (definition) (/$bunfs/root/chunk-nfqtvcwx.js:1085:10498)\n at SessionRunState.ensureRunning (/$bunfs/root/chunk-nfqtvcwx.js:1085:15267)\n at SessionRunState.ensureRunning (definition) (/$bunfs/root/chunk-nfqtvcwx.js:2:8179)\n at SessionPrompt.loop (/$bunfs/root/chunk-nfqtvcwx.js:1085:10220)\n at SessionPrompt.loop (definition) (/$bunfs/root/chunk-nfqtvcwx.js:1085:15203)\n at SessionPrompt.prompt (/$bunfs/root/chunk-ahr5v08n.js:4:13220)\n at SessionPrompt.prompt (definition) (/$bunfs/root/chunk-nfqtvcwx.js:1085:9838)"
Error: {
"name": "UnknownError",
"data": {
"message": "Unexpected server error. Check server logs for details.",
"ref": "err_baef6656"
}
}
timestamp=2026-08-07T16:53:20.765Z level=INFO run=39eeb06f message="disposing instance" directory=/home/melon
And with this command:
$opencode models --provider custom_openai --print-logs
timestamp=2026-08-07T16:54:48.319Z level=INFO run=9031b0cb message="creating instance" directory=/home/melon
timestamp=2026-08-07T16:54:48.329Z level=INFO run=9031b0cb message=fromDirectory directory=/home/melon
timestamp=2026-08-07T16:54:48.417Z level=INFO run=9031b0cb message=bootstrapping directory=/home/melon
timestamp=2026-08-07T16:54:48.478Z level=INFO run=9031b0cb message=loading path=/home/melon/.config/opencode/config.json
timestamp=2026-08-07T16:54:48.523Z level=INFO run=9031b0cb message=loading path=/home/melon/.config/opencode/opencode.json
timestamp=2026-08-07T16:54:48.549Z level=INFO run=9031b0cb message=loading path=/home/melon/.config/opencode/opencode.jsonc
timestamp=2026-08-07T16:54:49.235Z level=INFO run=9031b0cb message="all LSPs are disabled"
timestamp=2026-08-07T16:54:49.243Z level=INFO run=9031b0cb message="all formatters are disabled"
timestamp=2026-08-07T16:54:49.243Z level=INFO run=9031b0cb message=init
timestamp=2026-08-07T16:54:52.183Z level=INFO run=9031b0cb message="disposing instance" directory=/home/melon
Error: Provider not found: custom_openai
I also tried manualy creating ~/.local/share/opencode/auth.json, and its not working like opencode auth login --provider custom_openai command.
Plugins
No plugins
OpenCode version
1.18.14 (from pacman)
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
Arch Linux (Linux 7.1.5-arch1-2)
Terminal
Foot
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.