Unverified 提交 fe085225 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Add add-models skill (#2786)

## Summary - Add new skill definition for under . - Document required workflow for adding model configurations from official docs. ## Test plan - npm run fmt - npm run lint:fix - npm run ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2786" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> --------- Co-authored-by: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
上级 49c4c5c2
---
name: dyad:add-models
description: Add one or more AI models to the language model constants file, researching specs from official docs.
---
# Add Models
Add one or more AI models to `src/ipc/shared/language_model_constants.ts`, researching correct specifications from official documentation.
## Arguments
- `$ARGUMENTS`: Comma-separated list of model names to add (e.g., "gemini 3.1 pro, glm 5, sonnet 4.6").
## Instructions
1. **Parse the model list:**
Split `$ARGUMENTS` by commas to get individual model names. Trim whitespace from each.
2. **Read the current constants file:**
Read `src/ipc/shared/language_model_constants.ts` to understand:
- Which providers exist and their current model entries
- The naming conventions for each provider (e.g., `claude-sonnet-4-20250514` for Anthropic, `gemini-2.5-pro` for Google)
- The structure of `ModelOption` entries (name, displayName, description, maxOutputTokens, contextWindow, temperature, dollarSigns)
3. **Identify the provider for each model:**
Map each model to its provider based on the model name:
- **Anthropic** (`anthropic`): Claude models (Opus, Sonnet, Haiku)
- **OpenAI** (`openai`): GPT models
- **Google** (`google`): Gemini models
- **xAI** (`xai`): Grok models
- **OpenRouter** (`openrouter`): Models from other providers (DeepSeek, Qwen, Moonshot/Kimi, Z-AI/GLM, etc.)
- **Azure** (`azure`): Azure-hosted OpenAI models
- **Bedrock** (`bedrock`): AWS Bedrock-hosted Anthropic models
- **Vertex** (`vertex`): Google Vertex AI-hosted models
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.
4. **Research each model's specifications:**
For each model, use WebSearch and WebFetch to look up the official documentation:
- **Anthropic models**: Search `docs.anthropic.com` for model specs
- **OpenAI models**: Search `platform.openai.com/docs/models` for model specs
- **Google Gemini models**: Search `ai.google.dev/gemini-api/docs/models` for model specs
- **xAI models**: Search `docs.x.ai/docs/models` for model specs
- **OpenRouter models**: Search `openrouter.ai/<provider>/<model-name>` for model specs and pricing
For each model, determine:
- **API model name**: The exact string used in API calls (e.g., `claude-sonnet-4-5-20250929`, `gemini-2.5-pro`)
- **Display name**: Human-readable name (e.g., "Claude Sonnet 4.5", "Gemini 2.5 Pro")
- **Description**: Short description following the style of existing entries
- **Max output tokens**: The model's maximum output token limit
- **Context window**: The model's total context window size
- **Temperature**: Default temperature (0 for most models, 1 for OpenAI, 1.0 for Gemini 3.x models)
- **Dollar signs**: Cost tier from 0-6 based on pricing relative to other models in the same provider
**Dollar signs guide** (approximate, based on per-million-token input pricing):
- 0: Free
- 1: Very cheap (<$0.50/M input tokens)
- 2: Cheap ($0.50-$2/M)
- 3: Moderate ($2-$8/M)
- 4: Expensive ($8-$15/M)
- 5: Very expensive ($15-$30/M)
- 6: Premium ($30+/M)
5. **Follow provider-specific conventions:**
Match the patterns used by existing entries:
- **OpenAI**: `maxOutputTokens: undefined` (OpenAI errors with `max_tokens`), `temperature: 1`
- **Anthropic**: `maxOutputTokens: 32_000`, `temperature: 0`
- **Google**: `maxOutputTokens: 65_536 - 1` (exclusive upper bound for Vertex), `temperature` varies
- **OpenRouter**: `maxOutputTokens: 32_000`, prefix model name with provider (e.g., `deepseek/deepseek-chat-v3.1`)
- **Azure**: `maxOutputTokens` commented out, `temperature: 1`
- **Bedrock**: Model names use ARN format (e.g., `us.anthropic.claude-sonnet-4-5-20250929-v1:0`)
- **xAI**: `maxOutputTokens: 32_000`, `temperature: 0`
6. **Add the models to the constants file:**
Insert each new model entry into the appropriate provider's array in `MODEL_OPTIONS`. Place new models:
- At the **top** of the provider's array if it's the newest/most capable model
- After existing models of the same family but before older generations
- Add a comment with a link to the model's documentation page
Also check if related arrays need updating:
- `TURBO_MODELS`: If the model has a turbo variant
- `PROVIDERS_THAT_SUPPORT_THINKING`: If adding a new provider that supports thinking
7. **Check for named constant exports:**
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:
```
grep -r "SONNET_4_5\|GPT_5_2_MODEL_NAME\|GEMINI_3_FLASH" src/
```
8. **Verify the changes compile:**
```
npm run ts
```
Fix any type errors if they occur.
9. **Summarize what was added:**
Report to the user:
- Which models were added and to which providers
- The key specs for each (context window, max output, pricing tier)
- Any models that couldn't be found or had ambiguous specifications
- Any decisions that were made (e.g., choosing between model versions)
{ {
"name": "dyad", "name": "dyad",
"version": "0.37.0-beta.2", "version": "0.37.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "dyad", "name": "dyad",
"version": "0.37.0-beta.2", "version": "0.37.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@ai-sdk/amazon-bedrock": "^4.0.46", "@ai-sdk/amazon-bedrock": "^4.0.46",
......
...@@ -18,7 +18,7 @@ export interface ModelOption { ...@@ -18,7 +18,7 @@ export interface ModelOption {
} }
export const GPT_5_2_MODEL_NAME = "gpt-5.2"; export const GPT_5_2_MODEL_NAME = "gpt-5.2";
export const SONNET_4_5 = "claude-sonnet-4-5-20250929"; export const SONNET_4_6 = "claude-sonnet-4-6";
export const GEMINI_3_FLASH = "gemini-3-flash-preview"; export const GEMINI_3_FLASH = "gemini-3-flash-preview";
export const MODEL_OPTIONS: Record<string, ModelOption[]> = { export const MODEL_OPTIONS: Record<string, ModelOption[]> = {
...@@ -123,6 +123,18 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = { ...@@ -123,6 +123,18 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = {
temperature: 0, temperature: 0,
dollarSigns: 6, dollarSigns: 6,
}, },
// https://docs.anthropic.com/en/docs/about-claude/models/overview
{
name: SONNET_4_6,
displayName: "Claude Sonnet 4.6",
description:
"Anthropic's fast and intelligent model (note: >200k tokens is very expensive!)",
// Set to 32k since context window is 1M tokens
maxOutputTokens: 32_000,
contextWindow: 1_000_000,
temperature: 0,
dollarSigns: 5,
},
{ {
name: "claude-opus-4-5", name: "claude-opus-4-5",
displayName: "Claude Opus 4.5", displayName: "Claude Opus 4.5",
...@@ -135,7 +147,7 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = { ...@@ -135,7 +147,7 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = {
dollarSigns: 5, dollarSigns: 5,
}, },
{ {
name: SONNET_4_5, name: "claude-sonnet-4-5-20250929",
displayName: "Claude Sonnet 4.5", displayName: "Claude Sonnet 4.5",
description: description:
"Anthropic's best model for coding (note: >200k tokens is very expensive!)", "Anthropic's best model for coding (note: >200k tokens is very expensive!)",
...@@ -157,11 +169,11 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = { ...@@ -157,11 +169,11 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = {
}, },
], ],
google: [ google: [
// https://ai.google.dev/gemini-api/docs/models#gemini-3-pro // https://ai.google.dev/gemini-api/docs/models/gemini-3.1-pro-preview
{ {
name: "gemini-3-pro-preview", name: "gemini-3.1-pro-preview",
displayName: "Gemini 3 Pro (Preview)", displayName: "Gemini 3.1 Pro (Preview)",
description: "Google's latest Gemini model", description: "Google's most capable Gemini model",
// See Flash 2.5 comment below (go 1 below just to be safe, even though it seems OK now). // See Flash 2.5 comment below (go 1 below just to be safe, even though it seems OK now).
maxOutputTokens: 65_536 - 1, maxOutputTokens: 65_536 - 1,
// Gemini context window = input token + output token // Gemini context window = input token + output token
...@@ -249,6 +261,16 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = { ...@@ -249,6 +261,16 @@ export const MODEL_OPTIONS: Record<string, ModelOption[]> = {
temperature: 1.0, temperature: 1.0,
dollarSigns: 2, dollarSigns: 2,
}, },
// https://openrouter.ai/minimax/minimax-m2.5
{
name: "minimax/minimax-m2.5",
displayName: "MiniMax M2.5",
description: "Strong cost-effective model for real-world productivity",
maxOutputTokens: 32_000,
contextWindow: 196_608,
temperature: 0,
dollarSigns: 1,
},
{ {
name: "z-ai/glm-5", name: "z-ai/glm-5",
displayName: "GLM 5", displayName: "GLM 5",
......
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
FREE_OPENROUTER_MODEL_NAMES, FREE_OPENROUTER_MODEL_NAMES,
GEMINI_3_FLASH, GEMINI_3_FLASH,
GPT_5_2_MODEL_NAME, GPT_5_2_MODEL_NAME,
SONNET_4_5, SONNET_4_6,
} from "../shared/language_model_constants"; } from "../shared/language_model_constants";
import { getLanguageModelProviders } from "../shared/language_model_helpers"; import { getLanguageModelProviders } from "../shared/language_model_helpers";
import { LanguageModelProvider } from "@/ipc/types"; import { LanguageModelProvider } from "@/ipc/types";
...@@ -42,7 +42,7 @@ const AUTO_MODELS = [ ...@@ -42,7 +42,7 @@ const AUTO_MODELS = [
}, },
{ {
provider: "anthropic", provider: "anthropic",
name: SONNET_4_5, name: SONNET_4_6,
}, },
{ {
provider: "google", provider: "google",
...@@ -214,7 +214,7 @@ function getProModelClient({ ...@@ -214,7 +214,7 @@ function getProModelClient({
models: [ models: [
// openai requires no prefix. // openai requires no prefix.
provider.responses(`${GPT_5_2_MODEL_NAME}`, { providerId: "openai" }), provider.responses(`${GPT_5_2_MODEL_NAME}`, { providerId: "openai" }),
provider(`anthropic/${SONNET_4_5}`, { providerId: "anthropic" }), provider(`anthropic/${SONNET_4_6}`, { providerId: "anthropic" }),
provider(`gemini/${GEMINI_3_FLASH}`, { providerId: "google" }), provider(`gemini/${GEMINI_3_FLASH}`, { providerId: "google" }),
], ],
}), }),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论