Choose a model through the API
List the models your account may use, then choose one for a single run or for a whole conversation.
The examples use the ELOWEN_URL and ELOWEN_TOKEN variables set up in Send your first agent API request.
List the models you can use
curl -sS "$ELOWEN_URL/api/brain/models" -H "Authorization: Bearer $ELOWEN_TOKEN"
[
{ "provider": "anthropic", "providerLabel": "Anthropic", "model": "claude-sonnet-4-5", "exec": "anthropic/claude-sonnet-4-5", "contextWindow": 200000, "…": "…" }
]
The list contains only the models your account is allowed to use. Pass the exec value, which reads <provider>/<model>, wherever you choose a model.
Pick a model for one run
Add model to the run. The conversation switches to that model before the turn starts, and later runs of the same conversation stay on it:
curl -sS "$ELOWEN_URL/api/v1/agent/runs" \
-H "Authorization: Bearer $ELOWEN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message":"Review this diff","model":"anthropic/claude-sonnet-4-5"}'
Switch a conversation's model
Send POST /api/brain/model to switch an existing conversation, the same way the model picker in the web app does:
curl -sS "$ELOWEN_URL/api/brain/model" \
-H "Authorization: Bearer $ELOWEN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"anthropic/claude-sonnet-4-5","session":"brain-12-…"}'
{ "model": "claude-sonnet-4-5" }
Always pass the conversation as session. Without it, the switch applies to the conversation your web app has open.
If a model is refused
Both ways follow the same rules as the web app. A model your account may not use, or one that cannot take over this conversation, answers 409 with the same message the web app shows. The switch does not happen, and no turn runs.
Related guides
See Continue a conversation through the API to keep the conversation across runs, and Models and thinking for how the model picker works in the app.