|
| 1 | +--- |
| 2 | +name: dyad:add-models |
| 3 | +description: Add one or more AI models to the language model constants file, researching specs from official docs. |
| 4 | +--- |
| 5 | + |
| 6 | +# Add Models |
| 7 | + |
| 8 | +Add one or more AI models to `src/ipc/shared/language_model_constants.ts`, researching correct specifications from official documentation. |
| 9 | + |
| 10 | +## Arguments |
| 11 | + |
| 12 | +- `$ARGUMENTS`: Comma-separated list of model names to add (e.g., "gemini 3.1 pro, glm 5, sonnet 4.6"). |
| 13 | + |
| 14 | +## Instructions |
| 15 | + |
| 16 | +1. **Parse the model list:** |
| 17 | + |
| 18 | + Split `$ARGUMENTS` by commas to get individual model names. Trim whitespace from each. |
| 19 | + |
| 20 | +2. **Read the current constants file:** |
| 21 | + |
| 22 | + Read `src/ipc/shared/language_model_constants.ts` to understand: |
| 23 | + - Which providers exist and their current model entries |
| 24 | + - The naming conventions for each provider (e.g., `claude-sonnet-4-20250514` for Anthropic, `gemini-2.5-pro` for Google) |
| 25 | + - The structure of `ModelOption` entries (name, displayName, description, maxOutputTokens, contextWindow, temperature, dollarSigns) |
| 26 | + |
| 27 | +3. **Identify the provider for each model:** |
| 28 | + |
| 29 | + Map each model to its provider based on the model name: |
| 30 | + - **Anthropic** (`anthropic`): Claude models (Opus, Sonnet, Haiku) |
| 31 | + - **OpenAI** (`openai`): GPT models |
| 32 | + - **Google** (`google`): Gemini models |
| 33 | + - **xAI** (`xai`): Grok models |
| 34 | + - **OpenRouter** (`openrouter`): Models from other providers (DeepSeek, Qwen, Moonshot/Kimi, Z-AI/GLM, etc.) |
| 35 | + - **Azure** (`azure`): Azure-hosted OpenAI models |
| 36 | + - **Bedrock** (`bedrock`): AWS Bedrock-hosted Anthropic models |
| 37 | + - **Vertex** (`vertex`): Google Vertex AI-hosted models |
| 38 | + |
| 39 | + If a model could belong to multiple providers (e.g., a new Anthropic model should go in `anthropic` AND potentially `bedrock`), add it to the primary provider. Ask the user if they also want it added to secondary providers. |
| 40 | + |
| 41 | +4. **Research each model's specifications:** |
| 42 | + |
| 43 | + For each model, use WebSearch and WebFetch to look up the official documentation: |
| 44 | + - **Anthropic models**: Search `docs.anthropic.com` for model specs |
| 45 | + - **OpenAI models**: Search `platform.openai.com/docs/models` for model specs |
| 46 | + - **Google Gemini models**: Search `ai.google.dev/gemini-api/docs/models` for model specs |
| 47 | + - **xAI models**: Search `docs.x.ai/docs/models` for model specs |
| 48 | + - **OpenRouter models**: Search `openrouter.ai/<provider>/<model-name>` for model specs and pricing |
| 49 | + |
| 50 | + For each model, determine: |
| 51 | + - **API model name**: The exact string used in API calls (e.g., `claude-sonnet-4-5-20250929`, `gemini-2.5-pro`) |
| 52 | + - **Display name**: Human-readable name (e.g., "Claude Sonnet 4.5", "Gemini 2.5 Pro") |
| 53 | + - **Description**: Short description following the style of existing entries |
| 54 | + - **Max output tokens**: The model's maximum output token limit |
| 55 | + - **Context window**: The model's total context window size |
| 56 | + - **Temperature**: Default temperature (0 for most models, 1 for OpenAI, 1.0 for Gemini 3.x models) |
| 57 | + - **Dollar signs**: Cost tier from 0-6 based on pricing relative to other models in the same provider |
| 58 | + |
| 59 | + **Dollar signs guide** (approximate, based on per-million-token input pricing): |
| 60 | + - 0: Free |
| 61 | + - 1: Very cheap (<$0.50/M input tokens) |
| 62 | + - 2: Cheap ($0.50-$2/M) |
| 63 | + - 3: Moderate ($2-$8/M) |
| 64 | + - 4: Expensive ($8-$15/M) |
| 65 | + - 5: Very expensive ($15-$30/M) |
| 66 | + - 6: Premium ($30+/M) |
| 67 | + |
| 68 | +5. **Follow provider-specific conventions:** |
| 69 | + |
| 70 | + Match the patterns used by existing entries: |
| 71 | + - **OpenAI**: `maxOutputTokens: undefined` (OpenAI errors with `max_tokens`), `temperature: 1` |
| 72 | + - **Anthropic**: `maxOutputTokens: 32_000`, `temperature: 0` |
| 73 | + - **Google**: `maxOutputTokens: 65_536 - 1` (exclusive upper bound for Vertex), `temperature` varies |
| 74 | + - **OpenRouter**: `maxOutputTokens: 32_000`, prefix model name with provider (e.g., `deepseek/deepseek-chat-v3.1`) |
| 75 | + - **Azure**: `maxOutputTokens` commented out, `temperature: 1` |
| 76 | + - **Bedrock**: Model names use ARN format (e.g., `us.anthropic.claude-sonnet-4-5-20250929-v1:0`) |
| 77 | + - **xAI**: `maxOutputTokens: 32_000`, `temperature: 0` |
| 78 | + |
| 79 | +6. **Add the models to the constants file:** |
| 80 | + |
| 81 | + Insert each new model entry into the appropriate provider's array in `MODEL_OPTIONS`. Place new models: |
| 82 | + - At the **top** of the provider's array if it's the newest/most capable model |
| 83 | + - After existing models of the same family but before older generations |
| 84 | + - Add a comment with a link to the model's documentation page |
| 85 | + |
| 86 | + Also check if related arrays need updating: |
| 87 | + - `TURBO_MODELS`: If the model has a turbo variant |
| 88 | + - `PROVIDERS_THAT_SUPPORT_THINKING`: If adding a new provider that supports thinking |
| 89 | + |
| 90 | +7. **Check for named constant exports:** |
| 91 | + |
| 92 | + If the new model is likely to be referenced elsewhere (like `SONNET_4_5` or `GPT_5_2_MODEL_NAME`), create a named constant export for it. Search the codebase for references to similar constants to determine if one is needed: |
| 93 | + |
| 94 | + ``` |
| 95 | + grep -r "SONNET_4_5\|GPT_5_2_MODEL_NAME\|GEMINI_3_FLASH" src/ |
| 96 | + ``` |
| 97 | + |
| 98 | +8. **Verify the changes compile:** |
| 99 | + |
| 100 | + ``` |
| 101 | + npm run ts |
| 102 | + ``` |
| 103 | + |
| 104 | + Fix any type errors if they occur. |
| 105 | + |
| 106 | +9. **Summarize what was added:** |
| 107 | + |
| 108 | + Report to the user: |
| 109 | + - Which models were added and to which providers |
| 110 | + - The key specs for each (context window, max output, pricing tier) |
| 111 | + - Any models that couldn't be found or had ambiguous specifications |
| 112 | + - Any decisions that were made (e.g., choosing between model versions) |
0 commit comments