@@ -7,9 +7,11 @@ import {
77 retiredProviderIdentifiers ,
88 type ProviderSettings ,
99 type ModelInfo ,
10+ type ModelRecord ,
1011} from "@roo-code/types"
1112
1213import { getRouterRemovalMessage } from "../core/config/routerRemoval"
14+ import type { GetModelsOptions } from "../shared/api"
1315import { ApiStream } from "./transform/stream"
1416
1517import {
@@ -117,6 +119,18 @@ export interface ApiHandlerCreateMessageMetadata {
117119 abortSignal ?: AbortSignal
118120}
119121
122+ /**
123+ * Describes how the model cache must key and persist a provider's catalog.
124+ */
125+ export interface ModelCacheScope {
126+ /** Cache key must include the normalized baseUrl. */
127+ urlScoped : boolean
128+ /** Cache key must include a short, irreversible API-key discriminator. */
129+ keyScoped : boolean
130+ /** Never persist to disk/memory; results are per signed-in user. */
131+ authScoped : boolean
132+ }
133+
120134export interface ApiHandler {
121135 createMessage (
122136 systemPrompt : string ,
@@ -156,6 +170,18 @@ export interface ApiHandler {
156170 * @returns A promise resolving to the token count
157171 */
158172 countTokens ( content : Array < Anthropic . Messages . ContentBlockParam > ) : Promise < number >
173+
174+ /**
175+ * Fetch this provider's live model catalog. Only dynamic-catalog providers
176+ * implement it; others inherit the BaseProvider default that rejects.
177+ */
178+ fetchModels ?( options : GetModelsOptions , signal ?: AbortSignal ) : Promise < ModelRecord >
179+
180+ /**
181+ * How the model cache must key and persist this provider's catalog.
182+ * Defaults to all-false in BaseProvider.
183+ */
184+ getModelCacheScope ( ) : ModelCacheScope
159185}
160186
161187export function buildApiHandler ( configuration : ProviderSettings ) : ApiHandler {
0 commit comments