Shell Aliases to Switch Your Coding Agent Models
§1 Switch models without rebuilding your workflow
Changing your coding agent’s model should take one command, not another round of configuration edits. Shell aliases give you memorable launch commands for different models while keeping your project, terminal, and development habits intact.
This walkthrough uses Claude Code with Fluxio, a streaming-first, pay-per-token AI API relay. Fluxio fits this setup because it works with Claude Code and lets you access multiple model providers with one key. Responses arrive token by token, although the coding agent controls how that stream appears in your terminal.
§2 Check your agent and connection settings
Start with an installed, working copy of Claude Code. Run claude --version to confirm that your shell can find it. These aliases launch the existing executable; they do not install or update the agent.
In your Fluxio account, confirm the current Claude Code connection instructions and copy the exact API model identifiers for Claude Haiku 4.5 and Claude Sonnet 5.5. Display names are not necessarily valid identifiers, so do not derive request values from the names shown here.
Fluxio’s API base is https://api.fluxioapi.com. OpenAI-style clients add /v1, but this walkthrough uses Claude Code’s Anthropic-compatible connection settings instead. Confirm that your account’s integration instructions use the same endpoint before proceeding.
§3 Load your API key without saving it in an alias
Keep credentials separate from reusable shell configuration. In an interactive Bash or Zsh session, enter the following command, then paste your Fluxio key at the prompt:
$ printf 'Fluxio API key: '; read -r -s FLUXIO_API_KEY; printf '\n'; export FLUXIO_API_KEYThe input is hidden, and the key itself is not part of the command stored in shell history. Exporting it makes it available to child processes, so treat this terminal session as credential-bearing. For persistent use, prefer your existing secret manager rather than committing credentials to a dotfiles repository.
§4 Store the two model identifiers
$ Set two variables using the exact identifiers copied from your account. Replace both placeholder values before running these commands:$ export FLUXIO_FAST_MODEL='PASTE_FIRST_MODEL_ID_HERE'$ export FLUXIO_MAIN_MODEL='PASTE_SECOND_MODEL_ID_HERE'The variable names describe your preferred workflow, not guaranteed performance or quality. You might assign the first model to small edits and the second to larger changes, then adjust those choices after testing representative tasks.
§5 Create your launch aliases
Add the following aliases to ~/.bashrc for Bash or ~/.zshrc for Zsh. Save the model-variable assignments there too if you want those non-secret settings available in future terminals.
alias agent-fast='ANTHROPIC_BASE_URL=https://api.fluxioapi.com ANTHROPIC_AUTH_TOKEN="$FLUXIO_API_KEY" claude --model "$FLUXIO_FAST_MODEL"'
alias agent-main='ANTHROPIC_BASE_URL=https://api.fluxioapi.com ANTHROPIC_AUTH_TOKEN="$FLUXIO_API_KEY" claude --model "$FLUXIO_MAIN_MODEL"'
The outer single quotes preserve the variable references when the aliases are defined. Their values are expanded when you invoke an alias. Each launch supplies its endpoint, authentication token, and model explicitly, rather than relying on a previously selected default.
If your Fluxio integration instructions specify different authentication variables, follow those instructions. Also check for existing authentication settings that could conflict with the relay configuration.
§6 Reload, launch, and verify
Reload the file you edited with source ~/.bashrc or source ~/.zshrc. Then move into a project directory and run agent-fast or agent-main.
- – Confirm the selected model in the agent’s available session information.
- – Try a small, read-only request before allowing file changes.
- – Check Fluxio usage records to verify that the request reached the intended model.
- – If authentication fails, check the key and endpoint before changing model settings.
These aliases choose a model when launching a session; they do not automatically migrate an active conversation. Pay-per-token billing also means that cost depends on actual usage, not the alias name.
Sign up for Fluxio to try your model-switching workflow.