Skip to content

feat: runtime setup is a provider, key, model pick - #281

Merged
popodidi merged 1 commit into
mainfrom
axe/task-2438--work
Dec 1, 2026
Merged

popodidi merged 1 commit into
mainfrom
axe/task-2438--work

Conversation

@popodidi

@popodidi popodidi commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Task 2438 (owner msg #6509, Go #6511): setting up an API-key runtime is a generic provider -> key -> model pick; no provider is first-class.

What changes

Provider table (crates/axe-core/src/provider.rs)

  • New rows: openai, anthropic and google (Gemini), for OpenCode and Pi.
  • New other row ("Other…"):
    • Any OpenAI-compatible base URL plus key.
    • For Claude Code, an Anthropic-compatible URL.
  • Each row now carries:
    • how the key is sent (bearer or a header, e.g. Gemini x-goog-api-key)
    • required headers (anthropic-version)
    • which statuses mean a wrong key (Gemini answers a wrong key with 400)
    • a model-list call and its shape
  • Every row cites the provider's API doc. Wrong-key responses were checked live (20261201).

Model pick

  • When a new key passes its check, the node loads that provider's model list using the key.
  • The ready card lists the suggested model first, then the list (newest first, at most 48), eight per page with ‹ Back / More ›.
  • A press makes that model the runtime's default on that provider:
    • stored in state.json models
    • set through new Axe::runtime_model / POST /api/runtimes/<name>/model, node job runtime_model
  • The pick can be changed again on the same card, and a routing rule can still name another model.
  • If the list call fails, the runtime keeps the row's default_model and the card says so.
  • "Other…" has no default model:
    • it runs its first listed model
    • a server that lists no models adds nothing

Configs

  • OpenCode: opencode.json declares each held model under its provider. 2.4.3 refuses a model its catalog does not know ("Model unavailable"); this was verified, and so was the fix.
  • OpenCode: "Other…" is an @ai-sdk/openai-compatible provider with env: ["OTHER_API_KEY"].
  • Pi: settings carry the picked model; "Other…" goes in agent/models.json (openai-completions, $OTHER_API_KEY).
  • Claude Code: a picked non-default model, or any Other model, takes every tier.
  • The OpenCode and Pi configs were checked against real OpenCode 2.4.3 / Pi 1.7.0 runs on a local mock. Existing DeepSeek configs still reach api.deepseek.com.

Compatibility

  • Provider ids and stored key files are unchanged, so existing trials keep working: 2374 OpenCode DeepSeek and 2390 Claude Code DeepSeek.
  • No database schema change. The new per-runtime state is a state.json field with a serde default.

Behaviour changes (owner #5615/#5618)

  • Telegram /runtimes:
    • The provider step lists DeepSeek, OpenRouter, OpenAI, Anthropic and Google Gemini three per row, then "Other…" on its own row.
    • Claude's "Other provider…" shows DeepSeek, OpenRouter and Other….
    • "Other…" sends one sealed form with two fields, a base URL and the key.
    • The ready card now carries the model pick, or says why the list didn't load.
  • CLI output: axe runtimes login --help / axe rule add --help list the new provider ids (generated from the table).
  • API: the runtime report (GET /api/runtimes) adds providers[].model, and there is a new route POST /api/runtimes/<name>/model.
  • docs/user is updated in this PR: concepts/runtimes.md and guides/runtimes-from-telegram.md.

Tests

  • Provider rows, each against a mock:
    • key check per row, with the right auth header and extra headers
    • wrong-key status per row
    • model-list path per row
  • Model-list parsing against each provider's documented example response (DeepSeek, OpenAI, Anthropic, Gemini, OpenRouter, OpenAI-compatible).
  • "Other…" base URL rules and endpoints.
  • Telegram screen tests: provider list, key screen ("Other…" too), model pick paging, list-failure card text.
  • Integration (crates/axe/tests/telegram.rs):
    • /runtimes → provider → key → model list → pick updates opencode.json, state.json and the runtime report
    • an OpenRouter key whose model list returns 503 falls back to the default
    • "Other…" with URL and key in one sealed form

🤖 Generated with Claude Code

- provider table: OpenAI, Anthropic and Google Gemini rows beside DeepSeek
  and OpenRouter, and Other... (any OpenAI-compatible base URL + key; an
  Anthropic-compatible one for Claude Code); per-row key auth (bearer or a
  header), required headers, wrong-key statuses (Gemini: 400) and a model
  list call, each cited from the provider's API docs
- after a key passes its check the node loads that provider's model list
  with the key; the ready card offers it (suggested model first, eight a
  page) and a pick becomes the runtime's default model on that provider
  (state.json models, POST /api/runtimes/<name>/model); a failed list keeps
  the row's default
- OpenCode and Pi configs carry the picked model (declared under its
  provider for OpenCode) and Other as a custom provider; Claude Code takes
  a picked model on every tier
- /runtimes lists every provider, none first, with Other... last
- docs/user: providers, Other, the model pick

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@popodidi
popodidi merged commit db5364e into main Dec 1, 2026
3 checks passed
popodidi added a commit that referenced this pull request Dec 2, 2026
Owner pick A (tn-cos #6541/#6548): a runtime stores no model of its own.
Reverts the model pick of #281, keeping the provider -> key flow and rows.

- remove the ready-card model pick (rtmodel/rtmpage buttons; old ones now
  answer with the retired toast), POST /api/runtimes/<name>/model,
  Axe::runtime_model, the node's runtime_model job, Registry::set_model,
  state.json `models` (an old file still loads; the field is dropped) and
  the provider model-list call (list_models, parse_models, choices)
- a rule naming no model runs the provider row's default_model; the ready
  card says the runtime is ready with its provider and to ask the bot for
  another model; Other... has no default, so its card asks for one
- before a run whose rule names a model, the runtime's OpenCode/Pi config
  declares it under its provider (Runtime::write_config_for): OpenCode
  refuses an undeclared model its catalog lacks, and Other's models are
  known only from the rule
- runtime report: providers[] back to id and state
- docs/user: runtimes concept and Telegram guide

Co-authored-by: haojr <changhao+haojr@haostudio.cc>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant