You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds a Cheaper Inference provider preset and maps the cheaperinference/ model prefix to CHEAPER_INFERENCE_API_KEY for OpenCode.
It mirrors the Requesty preset.
Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.
Model ids are bare (for example gpt-5.4-mini). OpenCode model discovery lists the account's text models from /v1/models. doctor and onboard detect CHEAPER_INFERENCE_API_KEY.
Type of change
Bug fix
New feature
Breaking change
Documentation update
Refactoring
Other (describe below)
Checklist
pnpm run build passes
pnpm run test passes (provider and engine suites; the full run has one pre-existing flake in engine-abort.test.ts that passes in isolation and is unrelated to this change)
Thanks for the contribution! Local tests pass (1,341 passed, 6 skipped), but I found two issues to fix before merging:
The OpenCode provider config is incomplete. Cheaper Inference is not currently in models.dev, so it cannot rely on built-in defaults like Requesty. ensureOpenCodeConfig() generates only options.apiKey and models, even when given the documented base URL. Please also configure npm: "@ai-sdk/openai-compatible" and options.baseURL, honoring the configured URL. The new config test currently asserts the incomplete shape. See OpenCode's custom provider docs.
Model discovery ignores the supplied API key.listModels() reads only process.env.CHEAPER_INFERENCE_API_KEY, ignoring opts.apiKey. I verified that with only opts.apiKey, the models endpoint is never called; with both set, it uses the environment key instead. Please prefer opts.apiKey and fall back to the environment variable.
Could you fix both and add regression tests for the generated config and explicit-key handling? Please also resolve the conflicts with main. A short authenticated smoke test covering a reply and a tool call would help confirm the integration; please omit credentials.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a Cheaper Inference provider preset and maps the
cheaperinference/model prefix toCHEAPER_INFERENCE_API_KEYfor OpenCode.It mirrors the Requesty preset.
Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.
Usage:
Model ids are bare (for example
gpt-5.4-mini). OpenCode model discovery lists the account's text models from/v1/models.doctorandonboarddetectCHEAPER_INFERENCE_API_KEY.Type of change
Checklist
pnpm run buildpassespnpm run testpasses (provider and engine suites; the full run has one pre-existing flake inengine-abort.test.tsthat passes in isolation and is unrelated to this change)