Skip to main content

Overview

The /model command allows you to switch between different AI models without restarting the engine. This enables you to experiment with different models mid-session or optimize for specific use cases.

Syntax

/model <model_id>

Parameters

ParameterTypeRequiredDescription
model_idstringYesThe identifier of the model to activate

Behavior

When you execute /model:
  1. The engine validates that model_id exists in state.AVAILABLE_MODELS
  2. If valid, updates state.CURRENT_MODEL to the new model
  3. Sets state.MODEL_CONFIRMED to True
  4. Persists the change to disk via state.save_state()
  5. Sends a system update confirming the model change
The model change is immediate and affects all subsequent AI responses in the current and future sessions.

Examples

Switch to Claude Sonnet

/model claude-sonnet-4-20250514
Expected Output:
Hot-swapped model to claude-sonnet-4-20250514

Switch to GPT-4

/model gpt-4-turbo
Expected Output:
Hot-swapped model to gpt-4-turbo

Invalid Model

/model nonexistent-model
Expected Output:
Error: nonexistent-model is not recognized.

Available Models

The available models are defined in the engine’s state configuration. Common models include:
  • claude-sonnet-4-20250514 - Anthropic Claude Sonnet (latest)
  • claude-opus-4-20250514 - Anthropic Claude Opus
  • gpt-4-turbo - OpenAI GPT-4 Turbo
  • gpt-4o - OpenAI GPT-4 Optimized
To see the complete list of available models, check your engine configuration or the models API endpoint.

WebSocket Response

The engine sends a system_update event with the following payload:
{
  "event": "system_update",
  "payload": {
    "content": "Hot-swapped model to claude-sonnet-4-20250514",
    "metadata": {
      "model": "claude-sonnet-4-20250514",
      "model_confirmed": true
    }
  }
}

Source Code Reference

The /model command is implemented in engine/commands.py:23-41:
if cmd == "/model" and len(parts) >= 2:
    new_model = parts[1]
    if any(m["id"] == new_model for m in state.AVAILABLE_MODELS):
        state.CURRENT_MODEL = new_model
        state.MODEL_CONFIRMED = True
        state.save_state()
        await websocket.send_text(
            build_ws_payload(
                "system_update",
                f"Hot-swapped model to {state.CURRENT_MODEL}",
                {"model": state.CURRENT_MODEL, "model_confirmed": True},
            )
        )
    else:
        await websocket.send_text(
            build_ws_payload(
                "system_update", f"Error: {new_model} is not recognized."
            )
        )

Use Cases

Performance Optimization

Switch to faster models for quick interactions:
/model gpt-4o

Quality Enhancement

Switch to more capable models for complex storytelling:
/model claude-opus-4-20250514

Cost Management

Switch to more economical models when appropriate:
/model gpt-4-turbo

Common Issues

Model not recognized: Ensure the model ID exactly matches one from AVAILABLE_MODELS. Model IDs are case-sensitive.
Missing parameter: The command requires exactly one parameter. /model without arguments will be ignored.

Build docs developers (and LLMs) love