Skip to content

feat: add Infron as an open_code gateway provider - #126

Open
meridah7 wants to merge 1 commit into
Agent-Field:mainfrom
meridah7:feat/infron-provider
Open

feat: add Infron as an open_code gateway provider#126
meridah7 wants to merge 1 commit into
Agent-Field:mainfrom
meridah7:feat/infron-provider

Conversation

@meridah7

@meridah7 meridah7 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • What changed: Adds Infron as an open_code gateway provider. Infron is an OpenAI-compatible inference gateway serving the standard <provider>/<model> ids, so wiring it in is a base-URL change rather than a model-mapping exercise: infron/moonshotai/kimi-k2.6 routes the same model the bare id names, and nothing else in a deployment moves.
  • Why it changed: It gives deployers a second open-model gateway behind the exact same resolution rules, so switching (or A/B-ing) is an env-var change instead of a fork.

Disclosure: I work on Infron. Everything below is checkable from the diff and the commands under Validation.

File Change
docker/opencode.json New. The OpenCode provider block moves out of the two Dockerfiles into one shared file both images COPY, so they cannot drift apart. Declares infron (@ai-sdk/openai-compatible) next to the existing provider.
Dockerfile, go/Dockerfile Replace the inlined echo '{...}' config with COPY docker/opencode.json.
swe_af/execution/schemas.py _infron_only_env() + _INFRON_AUTO_DEFAULT_MODEL, following the existing gateway path through _default_runtime, _default_planning_model, and resolve_runtime_models.
go/internal/config/resolve.go Same, for the Go port (infronOnlyEnv, infronAutoDefaultModel).
agentfield-package.yaml, go/agentfield-package.yaml INFRON_API_KEY offered as a third llm_provider option.
.env.example, README.md Document the prefix swap and the auto-select rule.
tests/test_model_config.py, tests/test_dockerfile.py, go/internal/config/config_test.go Coverage for the new path and for the shared-config invariant.

Behavior

With only an INFRON_API_KEY set (no ANTHROPIC_API_KEY, no other gateway key, no SWE_DEFAULT_RUNTIME), SWE-AF auto-selects the open_code runtime and defaults to infron/deepseek/deepseek-v4-flash — the same rule the existing gateway path already follows, with the prefix swapped.

A gateway key that was already honored before Infron existed keeps precedence. Adding an Infron key never silently reroutes an existing deployment; moving traffic across is an explicit act (drop the other key, or set SWE_DEFAULT_MODEL=infron/...). A provider with no key set is never selected, so shipping both in the image costs nothing at runtime.

Validation

Rebased on main at 7a8dba0 and re-run today.

  • make checkpython -m pytest tests/ -q: 1154 passed, 1 skipped, 0 failed, plus python -m compileall -q swe_af/ clean
    (note for anyone reproducing: tests/conftest.py requires AGENTFIELD_SERVER to be set to a local address, e.g. AGENTFIELD_SERVER=http://localhost:9999, or every test errors at fixture setup)
  • cd go && go test ./...27 packages ok, 0 failures (Go 1.23.4)
  • cd go && go build ./... clean; gofmt -l internal/config/ clean
  • The 81 tests covering this change specifically (tests/test_model_config.py, tests/test_dockerfile.py) pass, including test_both_dockerfiles_share_one_opencode_config, which pins the new shared-config invariant.
  • Live smoke test against the gateway: moonshotai/kimi-k2.6, minimax/minimax-m2.5 and z-ai/glm-5.2 over https://llm.onerouter.pro/v1 return well-formed completions with usage accounting, on both the sync and the streaming path, under the same ids already used in the image.

Behavior Impact

  • No behavior change — every new path is gated on INFRON_API_KEY being the only gateway key present, and an existing key wins ties.

Notes

  • The docker/opencode.json extraction is the one structural change. It was the cleanest way to avoid a ~900-character echo line and to stop the Python and Go images from drifting; test_both_dockerfiles_share_one_opencode_config now pins that. Happy to inline it back into both Dockerfiles if you would rather keep the diff to a single mechanism.
  • @ai-sdk/openai-compatible providers are not in models.dev, so the model list has to be explicit. I listed the eight open-weight models SWE-AF realistically uses (Kimi K2.6 / K2.7-Code / K3, DeepSeek V4 Flash/Pro, MiniMax M2.5/M3, GLM-5.2). Easy to extend.
  • Companion PR on the SDK side, which is what makes infron/... work for AgentField apps generally: feat(sdk/go/ai): support the Infron gateway agentfield#874. The two are independent; either can land alone.
  • Happy to follow up with a joint benchmark on SWE-AF's own workload (same model, both gateways, cost + cache + latency side by side) if that is useful for the docs.

@meridah7
meridah7 requested a review from AbirAbbas as a code owner August 4, 2026 21:50
@CLAassistant

CLAassistant commented Aug 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@meridah7 meridah7 changed the title feat: add Infron as an open_code gateway provider alongside OpenRouter feat: add Infron as an open_code gateway provider Aug 4, 2026
Infron is an OpenAI-compatible inference gateway that serves the standard
<provider>/<model> ids, so wiring it in is a base-URL change rather than
a model-mapping exercise: infron/moonshotai/kimi-k2.6 routes the same
model the bare id names, and nothing else in a deployment moves.

- docker/opencode.json: the OpenCode provider block moves out of the two
  Dockerfiles into one shared file both images COPY, so they cannot drift
  apart. It now declares infron (@ai-sdk/openai-compatible) next to the
  existing provider; a provider with no key set is never selected, so
  shipping both costs nothing at runtime.
- INFRON_API_KEY follows the same resolution chain the existing gateway
  key does (Python and the Go port): with only that key present, SWE-AF
  auto-selects open_code and defaults to
  infron/deepseek/deepseek-v4-flash.
- A gateway key that was already honored before Infron existed keeps
  precedence, so adding an Infron key never silently reroutes an existing
  deployment.
- Manifests offer INFRON_API_KEY as a third llm_provider option; README
  and .env.example document the prefix swap.

No behavior change for any existing deployment: every new path is gated
on INFRON_API_KEY being the only gateway key present.
@meridah7
meridah7 force-pushed the feat/infron-provider branch from d00aabc to d6b950d Compare August 4, 2026 22:03
@meridah7 meridah7 changed the title feat: add Infron as an open_code gateway provider feat: add Infron as an open_code gateway provider Aug 4, 2026
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.

2 participants