Model Info
Utilities for working with model metadata.
Import
import {
getModelInfo,
isValidModel,
MODEL_INFO
} from '@activade/droid-sdk';
MODEL_INFO
Registry of model metadata:
const MODEL_INFO: Record<ModelId, ModelInfo> = {
'claude-opus-4-5-20251101': {
id: 'claude-opus-4-5-20251101',
name: 'Claude Opus 4.5',
provider: 'anthropic',
contextWindow: 200000,
maxOutput: 16384
},
'claude-sonnet-4-5-20250929': {
id: 'claude-sonnet-4-5-20250929',
name: 'Claude Sonnet 4.5',
provider: 'anthropic',
contextWindow: 200000,
maxOutput: 16384
},
// ... more models
};
ModelInfo Interface
interface ModelInfo {
/** Model identifier */
id: ModelId;
/** Human-readable model name */
name: string;
/** Model provider */
provider: 'anthropic' | 'openai' | 'google' | 'open-source';
/** Context window size in tokens */
contextWindow: number;
/** Maximum output tokens */
maxOutput: number;
}
getModelInfo()
Get metadata for a model:
function getModelInfo(modelId: string): ModelInfo | undefined
Example
const info = getModelInfo('claude-sonnet-4-5-20250929');
if (info) {
console.log(`${info.name} by ${info.provider}`);
console.log(`Context: ${info.contextWindow} tokens`);
console.log(`Max output: ${info.maxOutput} tokens`);
}
isValidModel()
Check if a model ID is valid:
function isValidModel(modelId: string): modelId is ModelId
Example
const modelId = 'claude-sonnet-4-5-20250929';
if (isValidModel(modelId)) {
// TypeScript knows modelId is ModelId
const droid = new Droid({ model: modelId });
}
Practical Examples
Model Comparison
import { MODEL_INFO, MODELS } from '@activade/droid-sdk';
// Compare context windows
const sonnet = MODEL_INFO[MODELS.CLAUDE_SONNET];
const haiku = MODEL_INFO[MODELS.CLAUDE_HAIKU];
console.log(`Sonnet context: ${sonnet.contextWindow}`);
console.log(`Haiku context: ${haiku.contextWindow}`);
Selecting by Provider
import { MODEL_INFO, ModelId } from '@activade/droid-sdk';
function getAnthropicModels(): ModelId[] {
return Object.values(MODEL_INFO)
.filter(m => m.provider === 'anthropic')
.map(m => m.id);
}
Validation
function createDroid(modelId: string) {
if (!isValidModel(modelId)) {
throw new Error(`Unknown model: ${modelId}`);
}
const info = getModelInfo(modelId)!;
console.log(`Using ${info.name}`);
return new Droid({ model: modelId });
}