Skip to main content

Function: parseModelId()

parseModelId(id): ParsedModelId

Defined in: packages/core/src/providers/registry.ts:162

Split a model id into the provider it routes to and the bare id that provider is sent.

The grammar, in order:

  • provider|id — the pipe always separates; the provider is the prefix when it names a known one (ollama|glm-5.2:cloud).
  • provider:id — split only when the prefix names a known provider, because model names contain colons (gemma2:9b).
  • a bare id — routed by a vendor-owned prefix from the catalog (claude- → anthropic, gpt- → openai, …).

Anything else — open model-family names like llama3, mistral, qwen, deepseek, or a bare :cloud/-cloud suffix — is AMBIGUOUS: those models can be served by Ollama, OpenRouter, Together, Groq, and others, so guessing a provider from the name silently mis-routes requests (and bills the wrong provider). For those ids provider is undefined; callers must supply one explicitly.

Parameters​

id​

string

Returns​

ParsedModelId