Skip to main content

Your own models

By default, Sage answers with AutoSage's free models, which share a daily free allowance with Autobot. Add a model with your own provider API key and Sage uses it instead, with no daily cap: you pay your provider directly.

These are the same models as Autobot's BYO configs on the web. Add one in either place and it's available in both.

Add a model​

sagex create model "<name>" --provider <provider> --model <model id> [--use]

SageCode asks for the API key at a hidden prompt. Add --use to start using the model straight away.

For example, a free model on OpenRouter:

sagex create model "Gemma 4 31B" --provider openrouter --model google/gemma-4-31b-it:free --use
OptionWhat it's for
--provider, -pgemini, groq, openrouter, anthropic, openai, azure_openai, nvidia_nim or custom (any LiteLLM-compatible endpoint)
--model, -mThe model id, e.g. anthropic/claude-sonnet-4-5, groq/llama-3.3-70b-versatile, gpt-4o-mini. For Azure OpenAI, your deployment name
--base-urlAn endpoint for a proxy, a self-hosted model or a custom provider. Leave it out to use the provider's own
--api-versionThe API version. Required for Azure OpenAI, e.g. 2024-08-01-preview
--key-fileRead the API key from this file instead of a hidden prompt
--useMake it the model Sage and Autobot answer with
Your API key stays secret

The key is typed at a hidden prompt or read from a file you choose. It's never passed as a flag, so it never lands in your shell history. AutoSage stores it encrypted and never shows it again, not even to SageCode.

Adding a model from the terminal app

Commands you run with ! in the terminal app can't show a hidden prompt. Put the key in a file and pass --key-file, then delete the file:

!sagex create model "Gemma 4 31B" --provider openrouter --model google/gemma-4-31b-it:free --key-file ~/openrouter-key.txt --use

Or run sagex create model in a normal terminal window.

Choose which model answers​

sagex use model "Gemma 4 31B" # use one of your models
sagex use model --free # back to AutoSage's free models

In the terminal app, /model lists your models with the one in use marked, and /model <number or name> or /model free switches.

  • The choice is account-wide: Autobot on the web answers with the same model.
  • It takes effect from your next message to Sage.
  • If your model stops working (an expired key, say), Sage falls back to the free models for that reply. The Sage Today block in the terminal app turns yellow and says so.

Manage your models​

To…Run
List your models, with the one in use markedsagex list model
See one model's settingssagex show model "Gemma 4 31B"
Change its model id, provider, endpoint or API versionsagex update model "Gemma 4 31B" --model meta-llama/llama-3.3-70b-instruct:free
Replace its API key (hidden prompt)sagex update model "Gemma 4 31B" --new-key
Replace its API key from a filesagex update model "Gemma 4 31B" --key-file ~/new-key.txt
Rename itsagex rename model "Gemma 4 31B" Gemma
Delete it and its stored keysagex delete model Gemma

update model keeps the stored key unless you pass --new-key or --key-file. Deleting the model in use switches Sage and Autobot back to the free models.

What Sage can do with your models​

Sage can list your models and, after you approve it on an approval card, switch which one is in use. It can never add a model or change a key: those commands aren't available to it.

Good to know​

  • Free models from a provider (like OpenRouter's :free models) are rate-limited by that provider, so you may see errors at busy times.
  • Models without tool support still work. Sage switches to writing its tool calls as text, and tells you once that a model with tool support works better.
  • A model id that doesn't exist isn't caught when you add it; you'll see the error on your first message.