Skip to content

feat: add Cheaper Inference as an open_code gateway provider - #165

Merged
AbirAbbas merged 3 commits into
Agent-Field:mainfrom
aiapienthusiast:cheaperinference-provider
Nov 23, 2026
Merged

AbirAbbas merged 3 commits into
Agent-Field:mainfrom
aiapienthusiast:cheaperinference-provider

Conversation

@aiapienthusiast

Copy link
Copy Markdown
Contributor

Summary

Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.

Its model ids are bare (one level), so a role ref is the provider prefix plus a bare id:

export CHEAPERINFERENCE_API_KEY="ci_live_..."
SWE_DEFAULT_MODEL=cheaperinference/gpt-5.4-mini

With only a CHEAPERINFERENCE_API_KEY set (no Anthropic key, no other gateway key, no SWE_DEFAULT_RUNTIME), the main paths auto-select open_code and default to cheaperinference/gpt-5.4-mini.
A gateway key already configured keeps precedence.

Validation

  • make check
  • Relevant manual test performed (if needed)

Behavior Impact

  • No behavior change
  • Backward compatible behavior change
  • Breaking change (explain below)

Notes

Every new path is gated on a Cheaper Inference key being the only gateway key present, so existing deployments do not change.

Details

Files:

  • opencode.json: a cheaperinference (@ai-sdk/openai-compatible) provider with base URL https://api.cheaperinference.com/v1 and the chat model ids it declares.
  • swe_af/execution/schemas.py and go/internal/config/resolve.go: _cheaperinference_only_env / cheaperInferenceOnlyEnv, the auto default constant, and the auto-select wiring.
  • .env.example, README.md, agentfield-package.yaml, go/agentfield-package.yaml: document the key.
  • docker-compose*.yml: pass CHEAPERINFERENCE_API_KEY to the services.
  • tests/test_model_config.py, go/internal/config/config_test.go, tests/test_dockerfile.py: cover auto-select, precedence, overrides, and the provider entry.

Live check: the default model gpt-5.4-mini returned a reply through the cheaperinference config's base URL, and every declared model id is a live text model from GET /v1/models.

@AbirAbbas

Copy link
Copy Markdown
Collaborator

Thanks for this. Before we can merge it, please sign our CLA: https://cla-assistant.io/Agent-Field/SWE-AF?pullRequest=165 (the CLA bot didn't run on this PR when it was opened, so nobody had asked yet).

I reviewed the change. The resolution chain matches Infron's in both Python and Go (I checked every key/env combination, and the two ports agree), and the new path only kicks in when Cheaper Inference is the only gateway key. Two things remain:

  • The existing runtime descriptions still say Infron is the only OpenCode auto-select case: the runtime tables in README.md and go/README.md, docs/deployment.md (its key table also omits CHEAPERINFERENCE_API_KEY), docs/ARCHITECTURE.md, .env.example, and the auto-runtime comments in the compose files and in _default_runtime / resolve.go. They should mention the new key and its cheaperinference/gpt-5.4-mini default.
  • feat: add Runcrate as an open_code gateway provider #172 adds Runcrate in the same spots, so whichever lands second needs a merge with main, and each *_only_env helper should also return false when the other new key is set.

Once the CLA is signed I'll take care of the docs and any conflict myself if you'd rather not.

AbirAbbas and others added 2 commits November 23, 2026 08:41
Agent-Field#172 (Runcrate) landed first and touches the same 13 files. Resolved as
unions: Runcrate stays first in the env example, compose files, manifests,
opencode.json providers, README and tests, with the Cheaper Inference entries
after it. Cheaper Inference is now the last gateway in the auto-selection
order, so its *_only_env helper (Python and Go) also yields to a Runcrate key.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…heaper Inference

The runtime tables in README, docs/deployment.md, docs/ARCHITECTURE.md and
go/README.md only named Infron (and now Runcrate) as the gateway keys that
auto-select open_code; add Cheaper Inference and its env row, and say that the
earlier gateway key wins when several are set.

Add CHEAPERINFERENCE_API_KEY to the tests that clear provider keys so an ambient
key cannot change their result, and to the OpenRouter-precedence, runtime-override
and QA-synthesizer model-resolution cases that already cover Runcrate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AbirAbbas

Copy link
Copy Markdown
Collaborator

CLA is in, so I took this over as said earlier. #172 (Runcrate) landed first and touched the same files, so I merged main and resolved it as a union: Runcrate stays first, and Cheaper Inference is last in the auto-select order, so its Python and Go helpers also yield to a RUNCRATE_API_KEY. Then fixed the stale runtime tables (README, docs/deployment.md, docs/ARCHITECTURE.md, go/README.md) and added the new key to the tests that clear provider env.

One gap I'm leaving as a follow-up: the Go node only builds its direct AI config for gateways the pinned Go SDK knows (Runcrate and Infron are there), so with just a Cheaper Inference key the Go flagged-QA synthesis uses its deterministic fallback. That needs the SDK side.

@AbirAbbas
AbirAbbas merged commit 89d3e7b into Agent-Field:main Nov 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Cheaper Inference as an open_code gateway provider

2 participants