feat(cli): add /fast to toggle between main and cheap model#200
Merged
emal-avala merged 1 commit intomainfrom Apr 23, 2026
Merged
feat(cli): add /fast to toggle between main and cheap model#200emal-avala merged 1 commit intomainfrom
emal-avala merged 1 commit intomainfrom
Conversation
Cost control without leaving the REPL. `/fast` swaps `api.model` with a configured `api.fast_model` (or a provider-aware default) for the rest of the session; `/fast` again reverts. > /fast Fast mode enabled. Model: 'claude-opus-4-7' → 'claude-haiku-4-5'. Run /fast again to revert. > /fast Fast mode disabled. Model restored to 'claude-opus-4-7'. New config field: [api] model = "claude-opus-4-7" fast_model = "claude-haiku-4-5" # explicit — overrides default When `fast_model` is not configured, `default_fast_model()` picks a provider-aware fallback: opus / sonnet → claude-haiku-4-5 gpt-5 → gpt-5-mini gpt-4 → gpt-4-mini gemini → gemini-flash grok → grok-mini (other) → "haiku" (forces user to configure explicitly) Implementation: AppState gains `pre_fast_model: Option<String>` (session-local, not persisted). `Some` ⇔ currently in fast mode; the pre-swap model is restored on the next toggle. No-op guard when the fast model equals the current model (prevents silent loss of the restore target). Tests: 5 unit tests covering provider fallbacks and case insensitivity in `default_fast_model`, plus `test_new_state` verifies the new `pre_fast_model: None` default.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Cost control without leaving the REPL.
/fastswapsapi.modelwith a configuredapi.fast_model(or a provider-aware default) for the rest of the session;/fastagain reverts.New config field
When
fast_modelis not configured,default_fast_model()picks a provider-aware fallback:your-fast-modelgpt-5-minigpt-4-minigemini-flashgrok-minihaiku(prompts user to configure explicitly)Implementation
ApiConfiggainsfast_model: Option<String>, defaultNoneAppStategainspre_fast_model: Option<String>— session-local,Some⇔ currently in fast mode/fastswap logic: save current, replace with fast_model; on second toggle, restore frompre_fast_modelfast_model == current_model(prevents silent loss of the restore target)Test plan
cargo fmt --all— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p agent-code --bin agent default_fast_model— 5/5 pass (provider fallbacks, case insensitivity, unknown provider)cargo test -p agent-code-lib --lib state— 10/10 pass (newpre_fast_model: Nonedefault assertion)