MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / toAnthropicModelId

Function toAnthropicModelId

common/src/constants/anthropic.ts:52–68  ·  view source on GitHub ↗
(openrouterModel: string)

Source from the content-addressed store, hash-verified

50 * Throws if the model has a non-anthropic provider prefix.
51 */
52export function toAnthropicModelId(openrouterModel: string): string {
53 // Already an Anthropic model ID (no provider prefix)
54 if (!openrouterModel.includes('/')) {
55 return openrouterModel
56 }
57
58 if (!openrouterModel.startsWith('anthropic/')) {
59 throw new Error(
60 `Cannot convert non-Anthropic model to Anthropic model ID: ${openrouterModel}`,
61 )
62 }
63
64 return (
65 OPENROUTER_TO_ANTHROPIC_MODEL_MAP[openrouterModel] ??
66 openrouterModel.replace('anthropic/', '')
67 )
68}

Callers 1

countTokensViaAnthropicFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected