/** * kosha-discovery (कोश) — Model ID normalization utilities. * * Provides functions to extract the originating model creator from a * compound model ID and to strip provider prefixes / version suffixes * so that IDs from different serving layers can be compared uniformly. * @module */ /** * Extract the origin provider (model creator) from a model ID. * * The function first attempts to resolve a slash-separated namespace prefix * (e.g. `"anthropic/claude-opus-4-8"` → `"anthropic"`). When no prefix is * present it falls back to a set of well-known ID patterns. * * @param modelId - Raw model identifier as returned by a provider API. * @returns Canonical origin-provider slug, or `undefined` when the creator * cannot be determined. * * @example * extractOriginProvider("anthropic/claude-opus-4-8") // "anthropic" * extractOriginProvider("openai/gpt-4o") // "openai" * extractOriginProvider("google/gemini-2.5-pro") // "google" * extractOriginProvider("meta-llama/llama-3.3-70b") // "meta" * extractOriginProvider("claude-opus-4-8") // "anthropic" * extractOriginProvider("gpt-4o") // "openai" * extractOriginProvider("gemini-2.5-pro") // "google" * extractOriginProvider("unknown-model") // undefined */ export declare function extractOriginProvider(modelId: string): string | undefined; /** * Normalise a model ID by stripping provider prefixes and version suffixes * so that the same underlying model — served from different providers or * released with different date stamps — yields the same base ID for * deduplication or alias matching. * * Transformations applied (in order): * 1. Strip everything up to and including the first `/` (provider prefix). * 2. Strip calendar-version suffixes of the form `-YYYY-MM-DD` or `-YYYYMMDD`. * 3. Strip the `:latest` tag used by Ollama. * * @param modelId - Raw model identifier (possibly namespaced / versioned). * @returns Cleaned base model ID ready for deduplication comparisons. * * @example * normalizeModelId("anthropic/claude-opus-4-8") // "claude-opus-4-8" * normalizeModelId("openai/gpt-4o-2024-11-20") // "gpt-4o" * normalizeModelId("meta-llama/llama-3.3-70b-instruct") // "llama-3.3-70b-instruct" * normalizeModelId("claude-opus-4-8") // "claude-opus-4-8" * normalizeModelId("llama3.3:latest") // "llama3.3" */ export declare function normalizeModelId(modelId: string): string; /** * Looser ID form for cross-provider matching only. * * Different providers format the same Claude / GPT / Gemini version * differently — OpenRouter uses dots (`claude-sonnet-4.6`), aliases and * litellm use dashes (`claude-sonnet-5`), some services use underscores. * `normalizeModelId` is intentionally non-destructive and preserves the * original separators because callers serialize its output. This helper * is for *matching* only: collapse every `` to a dash * so that `modelRoutes("claude-sonnet-5")` finds the OpenRouter entry * `anthropic/claude-sonnet-4.6`. */ export declare function matchableModelId(modelId: string): string; /** * Extract a best-effort model version hint from an identifier. * * Supported patterns (in priority order): * 1. Provider suffix versions like `-v1:0` (Bedrock style) * 2. Date suffixes `YYYY-MM-DD` or `YYYYMMDD` * 3. Semantic fragments like `gpt-5.3-codex` -> `5.3` * * Returns `undefined` when no clear version-like segment is detected. */ export declare function extractModelVersion(modelId: string): string | undefined; //# sourceMappingURL=normalize.d.ts.map