feat: add a model registry so you can use `provider/model` strings wi…

Merged
OM
9mo ago
+13189-2352

…thout importing provider

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers


Summary by cubic

Adds a built-in model registry and router so you can set model: "provider/model" without importing provider SDKs. Updates examples and templates to use model strings and removes provider dependencies.

  • New Features

    • Resolve provider/model strings at runtime (OpenAI, Anthropic, Google, Groq, Amazon Bedrock, Google Vertex).
    • Agents and scorers accept string model references; dynamic model functions can return strings.
    • Next.js chatbot template normalizes model via env (OPENAI_MODEL, ANTHROPIC_MODEL, GOOGLE_MODEL, GROQ_MODEL) and falls back to openai/gpt-4o-mini.
  • Migration

    • Replace openai("gpt-4o-mini") and similar with "openai/gpt-4o-mini".
    • Remove @ai-sdk/* provider imports and dependencies from apps/examples.
    • For Bedrock, use standard AWS env vars and "amazon-bedrock/".
    • Update types where needed (e.g., LanguageModel -> AgentModelReference in scorers).