Skip to content

Restore first-class Anthropic API provider (direct, not via Bedrock) #176

Description

@polaris-is-online

The anthropic provider has no backend in the router. createBackendFromConfig in packages/llm/src/model-router.ts switches on bedrock, openai-compatible, cerebras, zai, opencode-go, and bedrock-mantle, and throws on anything else. anthropic was deliberately dropped in the AI SDK migration (the routers default-case comment says as much), on the assumption that Anthropic traffic would route through Bedrock instead.

The result is a provider that looks supported but is not. The config schema enum in packages/shared/src/config-schemas.ts still accepts provider: "anthropic" and its api_key refine still requires a key for it, so a hand-written config naming anthropic parses clean and then dies at router construction. The init --anthropic preset wrote exactly such a config until it was removed in f31abed2.

This issue asks for a real anthropic provider driver over the Vercel AI SDK Anthropic provider, so direct Anthropic API access is a first-class backend again rather than a Bedrock detour. Bedrock is an AWS dependency with its own auth and region story; someone holding an Anthropic key and no AWS account should not have to stand up Bedrock to use Claude.

Scope:

  • An Anthropic driver wired into the createBackendFromConfig switch, reading api_key and an optional base_url.
  • Verify the cross-provider portability rules already in place for Bedrock-Anthropic carry over: tool_use id/name sanitization and thinking-signature handling in ai-sdk-bridge.ts key off the same wire validation, so they should cover the direct path, but it is worth confirming against a live key.
  • Cache-control and extended-thinking parity with the Bedrock-Anthropic path.
  • Restore the init --anthropic preset once the driver lands.

Note on the enum: a sibling change drops ollama from the provider enum (local inference is reached through openai-compatible now, with no plan to bring ollama back). anthropic is being LEFT in the enum precisely because of this issue, so restoring it is driver-plus-refine work with no schema-enum change needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions