|
1 | | -import { Controller, Get, Route, Tags } from "tsoa"; |
| 1 | +import { Controller, Get, Route, Tags, Example } from "tsoa"; |
2 | 2 | import { err, ok, Result } from "../../packages/common/result"; |
3 | 3 | import { registry } from "../../../../../packages/cost/models/registry"; |
4 | 4 | import { getProviderDisplayName } from "../../../../../packages/cost/models/provider-helpers"; |
@@ -82,7 +82,69 @@ export class ModelRegistryController extends Controller { |
82 | 82 | return slugMap[provider.toLowerCase()] || provider.toLowerCase(); |
83 | 83 | } |
84 | 84 |
|
| 85 | + /** |
| 86 | + * Get all available models from the registry |
| 87 | + * @summary Returns a comprehensive list of all AI models with their configurations, pricing, and capabilities |
| 88 | + * @description This endpoint provides detailed information about all available models including: |
| 89 | + * - Model metadata (name, author, context length, training date) |
| 90 | + * - Supported providers and endpoints |
| 91 | + * - Pricing information (per million tokens for prompt/completion/special features) |
| 92 | + * - Input/output modalities (text, image, audio, video) |
| 93 | + * - Supported parameters (temperature, max_tokens, etc.) |
| 94 | + * - Available capabilities (audio, video, image, thinking, web_search, caching) |
| 95 | + * |
| 96 | + * No authentication required - this is a public endpoint. |
| 97 | + * |
| 98 | + * @returns {ModelRegistryResponse} Complete model registry with models and filter options |
| 99 | + */ |
85 | 100 | @Get("/models") |
| 101 | + @Example<ModelRegistryResponse>({ |
| 102 | + models: [ |
| 103 | + { |
| 104 | + id: "claude-opus-4-1", |
| 105 | + name: "Anthropic: Claude Opus 4.1", |
| 106 | + author: "anthropic", |
| 107 | + contextLength: 200000, |
| 108 | + endpoints: [ |
| 109 | + { |
| 110 | + provider: "anthropic", |
| 111 | + providerSlug: "anthropic", |
| 112 | + supportsPtb: true, |
| 113 | + pricing: { |
| 114 | + prompt: 15, |
| 115 | + completion: 75, |
| 116 | + cacheRead: 1.5, |
| 117 | + cacheWrite: 18.75, |
| 118 | + }, |
| 119 | + }, |
| 120 | + ], |
| 121 | + maxOutput: 32000, |
| 122 | + trainingDate: "2025-08-05", |
| 123 | + description: "Most capable Claude model with extended context", |
| 124 | + inputModalities: ["text" as InputModality], |
| 125 | + outputModalities: ["text" as OutputModality], |
| 126 | + supportedParameters: [ |
| 127 | + "max_tokens" as StandardParameter, |
| 128 | + "temperature" as StandardParameter, |
| 129 | + "stop" as StandardParameter, |
| 130 | + "reasoning" as StandardParameter, |
| 131 | + "include_reasoning" as StandardParameter, |
| 132 | + "tools" as StandardParameter, |
| 133 | + "tool_choice" as StandardParameter, |
| 134 | + ], |
| 135 | + }, |
| 136 | + ], |
| 137 | + total: 150, |
| 138 | + filters: { |
| 139 | + providers: [ |
| 140 | + { name: "anthropic", displayName: "Anthropic" }, |
| 141 | + { name: "openai", displayName: "OpenAI" }, |
| 142 | + { name: "google", displayName: "Google" }, |
| 143 | + ], |
| 144 | + authors: ["anthropic", "openai", "google", "meta"], |
| 145 | + capabilities: ["audio", "image", "thinking", "caching", "reasoning"], |
| 146 | + }, |
| 147 | + }) |
86 | 148 | public async getModelRegistry(): Promise< |
87 | 149 | Result<ModelRegistryResponse, string> |
88 | 150 | > { |
|
0 commit comments