Model Addition Workflow Summary
March 25, 2026 · View on GitHub
This document provides a high-level overview of the model addition process and automation approach.
Why This Workflow?
Adding a new LLM model to VT Code requires updates across three architectural layers:
┌─────────────────────────────────────────────┐
│ Application Layer (Runtime) │
│ - /model palette & selection │
│ - Model capabilities discovery │
├─────────────────────────────────────────────┤
│ Configuration Layer (Resolution) │
│ - ModelId enum & match arms │
│ - Provider assignment │
│ - Capability flags │
├─────────────────────────────────────────────┤
│ Constants Layer (Database) │
│ - String constants (openai.rs) │
│ - Metadata (docs/models.json) │
└─────────────────────────────────────────────┘
Each layer must be independently coherent AND logically connected. This is why a simple script can't fully automate the process—it must be intentional and verifiable at each step.
The 10-Step Process
Layer 1: Constants (2 files)
- openai.rs - Add to
SUPPORTED_MODELSarray + define convenience constant - models.json - Complete metadata entry (context, capabilities, modalities)
Layer 2: Configuration (8 files)
- model_id.rs - Add enum variant with doc comment
- as_str.rs - Map enum to constant string
- display.rs - Map enum to display name
- description.rs - Map enum to description text
- parse.rs - Map string to enum (enables CLI parsing)
- provider.rs - Assign to provider (OpenAI, Anthropic, etc.)
- collection.rs - Add to all_models() discovery list
- capabilities.rs - Add to generation() and optional trait methods
Automation Level: 60% (Guided, Not Fully Automated)
Why Not 100% Automation?
Full automation would require:
- Complex AST parsing and code generation
- Maintaining sync between 10 disparate file formats
- No opportunity for human verification
- Brittle brittle if files change format
What We Provide Instead
v Documentation (ADDING_MODELS.md)
- Detailed instructions for each file
- Examples for copy-paste
- Verification steps
v Checklist (MODEL_ADDITION_CHECKLIST.md)
- Step-by-step verification
- Testing template
- Common issues & fixes
v Helper Script (scripts/add_model.sh)
- Interactive prompts for model details
- Generates code snippets for all 10 files
- Guides you through manual insertion points
v Quick Template
# Run this to get guided prompts + code generation
./scripts/add_model.sh
Typical Workflow
Option A: Manual (Recommended First Time)
- Read
docs/development/ADDING_MODELS.md - Open all 10 files in editor split-view
- Follow detailed step-by-step guide
- Verify with checklist
- Run cargo check
Time: 15-20 min first time, 5-10 min afterwards
Option B: Script-Guided (Recommended for Speed)
./scripts/add_model.sh
# Prompts you for model details
# Generates code snippets for all files
# Shows you exact insertion points
# Copy-paste into files
# Run cargo check
Time: 5-10 min
Option C: Future Full Automation (if needed)
Could build:
- Declarative model registry (YAML)
- Code generator in
build.rs - Auto-inserts in files with markers
But trades off:
- Explicitness (good for auditing)
- Flexibility (adding new provider types)
- Learning value (understanding all layers)
File Dependency Graph
models.json (metadata source)
↓
├→ as_str.rs (string mapping)
├→ display.rs (names)
├→ description.rs (descriptions)
└→ capabilities.rs (introspection)
model_id.rs (enum definition)
↓
├→ parse.rs (CLI parsing)
├→ provider.rs (provider assignment)
├→ collection.rs (discovery)
└→ capabilities.rs (trait implementations)
openai.rs (constants)
↓
└→ as_str.rs (constant references)
Verification Strategy
Compile Check
cargo check --package vtcode-config
cargo check --all-targets
cargo clippy --workspace --all-targets -- -D warnings
Functional Check
# Model appears in palette
vtcode ask --model gpt-5.4-nano "test"
# String parsing works
echo 'gpt-5.4-nano' | cargo test -- --nocapture
Test Template
#[test]
fn test_new_model() {
let model = "gpt-5.4-nano".parse::<ModelId>().unwrap();
assert_eq!(model.provider(), Provider::OpenAI);
assert_eq!(model.generation(), "5.4");
}
Next Steps
For Next Model Addition
-
Check the docs first:
open docs/development/ADDING_MODELS.md -
Use the script for guidance:
./scripts/add_model.sh -
Follow the checklist:
open docs/development/MODEL_ADDITION_CHECKLIST.md -
Run verification:
cargo check --package vtcode-config cargo clippy --workspace --all-targets -- -D warnings
Ideas for Further Improvement
- Add GitHub issue template for new models
- Create editor snippet for each file type
- Build Rust macro for boilerplate generation
- Add git hook to verify all 10 files updated
- Create test generator from models.json
Key Principles
- Explicit over implicit - All 10 files updated, all locations visible
- Verifiable at each step - Cargo check after phase 1, 2, 3
- Documented patterns - Follow existing model patterns exactly
- Single source of truth - models.json is metadata source
- Type-safe resolution - Enum catches missing cases