Claude API: Models — Function Reference

Source files: features.js (1064 LOC), registry-v2.js (759 LOC), response-format.js (803 LOC), index.js


Exported Functions — features.js

getModelFeatures(modelId): ModelFeatures

Purpose: Return complete feature configuration for a model. Parameters:

  • modelId (string): e.g. “claude-3-7-sonnet-20250219”

Returns: Nested ModelFeatures object by category (output, reasoning, tools, format, safety, performance, beta). Throws: Error if model not found in MODEL_FEATURES map.


isFeatureAvailable(modelId, category, feature): boolean

Purpose: Check if a feature is available (FULL or BETA level) for a model. Parameters:

  • category (FeatureCategory): output reasoning tools format safety performance beta
  • feature (string): Feature name within category

Returns: true if available !== NONE, false otherwise (including on error).


isFeatureBeta(modelId, category, feature): boolean

Purpose: Check if a feature is specifically in BETA availability for a model.


getFeatureConfig(modelId, category, feature): object|null

Purpose: Get the full feature configuration object for a specific feature. Returns: Feature config object (e.g. { available, maxTokens, requiresFlag, flagName }) or null.


getAvailableFeatures(modelId): AvailableFeatures

Purpose: Return all non-NONE features grouped by category. Returns: { output: {...}, reasoning: {...}, tools: {...}, ... } with only available entries.


getModelsWithFeature(category, feature, options): string[]

Purpose: Find all models that support a given feature. Parameters:

  • category (string)
  • feature (string)
  • includeBeta (boolean): Include BETA-availability models (default: false)

Returns: Array of model ID strings.


getRequiredFeatureFlags(modelId): string[]

Purpose: Get all Anthropic beta header flags required to use a model’s features. Returns: Deduplicated array of flag names like ["output-128k-2025-02-19", "thinking-2025-02-19"].


supportsExtendedOutput(modelId): boolean

Purpose: Shortcut — checks output.extendedOutput availability.


supportsThinkingMode(modelId): boolean

Purpose: Shortcut — checks reasoning.thinkingMode availability.


supportsToolChoice(modelId): boolean

Purpose: Shortcut — checks tools.toolChoice availability.


supportsJsonMode(modelId): boolean

Purpose: Checks if model’s format.responseFormat.formats includes “json”.


getToolChoiceModes(modelId): string[]

Purpose: Get available tool choice modes for a model. Returns: e.g. ["auto", "any", "tool"] or ["auto"] as fallback.


getResponseFormats(modelId): string[]

Purpose: Get available response format types. Returns: e.g. ["text", "json", "json_object"].


validateFeatureValue(modelId, category, feature, value): ValidationResult

Purpose: Validate a proposed feature value against the model’s constraints. Parameters:

  • value (any): The value to validate (number, string, etc.)

Returns: { valid: true } or { valid: false, error: string } Notes for rewrite: Validates: numeric min/max, string formats enum, tool choice modes enum.


Model Registry (features.js constants)

MODEL_FEATURES (object)

Feature table for all supported models:

Model ID Extended Output Thinking Mode Computer Use Max Tokens
claude-3-7-sonnet-20250219 FULL (128K, beta flag) FULL (beta flag) FULL 128K
claude-3-7-sonnet-20250219-extended BETA BETA FULL 128K
claude-3-5-haiku-20241022 FULL (8K) NONE NONE 8192
claude-3-5-haiku-latest FULL (8K) NONE NONE 8192
claude-3-5-sonnet-20241022 FULL (8K) NONE FULL 8192
claude-3-opus-20240229 NONE (4K) NONE NONE 4096

All models support: streaming, tool use, tool choice (auto/any/tool), prompt caching, batch API.


Constants: FeatureCategory

OUTPUT, REASONING, TOOLS, FORMAT, SAFETY, PERFORMANCE, BETA

Constants: FeatureAvailability

| Value | Meaning | |——-|———| | FULL | Fully available | | PARTIAL | Partially supported | | BETA | Available but experimental (may require flag) | | NONE | Not supported |


Exported Functions — registry-v2.js

getModel(modelId): ModelDefinition

Purpose: Get complete model definition from registry. Throws: Error if not found.


listModels(options): ModelDefinition[]

Purpose: List available models with optional filtering. Parameters:

  • capability (string null): Filter by capability name
  • family (string null): Filter by model family (e.g. “claude-3-7”)
  • includeDeprecated (boolean): Include deprecated models

getLatestModel(family): string

Purpose: Get latest model ID for a family (e.g. “claude-3-5-sonnet” → “claude-3-5-sonnet-20241022”).


isModelSupported(modelId): boolean

Purpose: Check if model ID is in the registry.


getModelCapabilities(modelId): string[]

Purpose: Return list of capability names for a model.


resolveModelAlias(alias): string

Purpose: Resolve aliases like “claude-3-sonnet” → full model ID.


Constants: ExtendedCapability (registry-v2.js)

Enum of capability strings: EXTENDED_OUTPUT, THINKING_MODE, COMPUTER_USE, TOOL_USE, STREAMING, PROMPT_CACHING, BATCH, CITATIONS, JSON_MODE, etc.


Exported Functions — response-format.js

createResponseFormat(modelId, options): ResponseFormatConfig

Purpose: Build the correct response format configuration for an API request. Parameters:

  • format (string): “text” “json” “json_object”
  • schema (object null): JSON schema for structured output (if format is json)
  • strict (boolean): Enable strict schema validation

Returns: Config object suitable for Anthropic messages API response_format parameter. Notes for rewrite: Validates that the model supports the requested format before building config.


validateResponseFormat(modelId, format): ValidationResult

Purpose: Check if a response format is valid for a given model.


parseStructuredResponse(content, schema): ParsedResult

Purpose: Parse a JSON response and validate against schema. Parameters:

  • content (string): Raw model response content
  • schema (object): Expected JSON schema

Returns: { success, data, validationErrors }


Key Data Structures

Structure Fields Purpose
ModelFeatures model, version, output, reasoning, tools, format, safety, performance, beta Per-model feature table
FeatureConfig available, [supported, enabled, maxTokens, min, max, default, requiresFlag, flagName, etc.] Feature configuration
ValidationResult valid: boolean, error?: string Feature value validation

External Dependencies

  • ./registry-v2.jsExtendedCapability enum (imported by features.js)
  • No Anthropic SDK calls — this is a static configuration layer

Notes for Rewrite

  • MODEL_FEATURES is the authoritative feature table — keep in sync with Anthropic API changes.
  • Models with requiresFlag: true need the corresponding anthropic-beta header to activate the feature.
  • claude-3-7-sonnet-20250219 extended output flag: "output-128k-2025-02-19".
  • Thinking mode flag: "thinking-2025-02-19" with budget range 1024–32000 tokens.
  • topK is listed as NONE for all current models — API does not support it despite older docs.
  • The DEFAULT_FEATURE_CONFIG object is not used in queries — it is only a documentation reference for defaults.

Back to top

Colibri — documentation-first MCP runtime. Apache 2.0 + Commons Clause.

This site uses Just the Docs, a documentation theme for Jekyll.