Latest Sandbox Image 0.7.8 doesn't work when trying to use opencode with CF AI Gateway
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 345
- Avg merge
- 13h 31m
- Merged PRs (30d)
- 1
Description
See here: https://github.com/anomalyco/opencode/issues/13758#issuecomment-3975592970
I confirmed with `opencode --version` the image is running `opencode 1.2.15`.
I am configured with Cloudflare AI Gateway and trying to use `cloudflare-ai-gateway/anthropic/claude-sonnet-4-6`.
Logs from `opencode`:
```
WARN 2026-02-27T22:38:41 +726ms service=bun pkg=ai-gateway-provider cachedVersion=3.1.1 Failed to resolve latest version, using cached
INFO 2026-02-27T22:38:41 +2ms service=provider status=completed duration=11137 providerID=cloudflare-ai-gateway getSDK
ERROR 2026-02-27T22:38:41 +18ms service=session.processor error=sdk.languageModel is not a function. (In 'sdk.languageModel(model.api.id)', 'sdk.languageModel' is undefined) stack="TypeError: sdk.languageModel is not a function. (In 'sdk.languageModel(model.api.id)', 'sdk.languageModel' is undefined)\n at getLanguage (src/provider/provider.ts:1181:15)\n at processTicksAndRejections (native:7:39)" process
```
For additional context I'm using the official cloudflare sandbox image `0.7.8`: https://hub.docker.com/layers/cloudflare/sandbox/0.7.8-opencode/images/sha256-ec3f866fc3bb3b2e12f789498b191afc1789371f06abb54f73d01da5bc91e20b
[This comment](https://github.com/anomalyco/opencode/issues/13758#issuecomment-3959853053) is pointing at CF AI Gateway Provider code so I figured I'd open an issue here too.
Contributor guide
Research direction
Reproduce with Cloudflare Sandbox image 0.7.8-opencode, opencode 1.2.15, and the cloudflare-ai-gateway/anthropic/claude-sonnet-4-6 configuration. Start at the reported opencode src/provider/provider.ts:1181 stack location and review the linked AI Gateway provider discussion; done means the configured model runs without the sdk.languageModel TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100