Skip to content

bug: Claude Code agent model aliases hardcoded to anthropic/ provider #3296

@kilhyeonjun

Description

@kilhyeonjun

Problem

.claude/agents/*.md files use model aliases (model: opus, model: sonnet, model: haiku) which claude-model-mapper.ts resolves to anthropic/claude-opus-4-6, etc. with a hardcoded ANTHROPIC_PREFIX.

Users who proxy Anthropic models through custom gateways (e.g., Kiro, LiteLLM) and don't have an anthropic provider configured get:

Model not found: anthropic/claude-opus-4-6

Root Cause

src/features/claude-code-agent-loader/claude-model-mapper.ts line 4-10:

const ANTHROPIC_PREFIX = "anthropic/"
const CLAUDE_CODE_ALIAS_MAP = new Map([
  ["sonnet", `${ANTHROPIC_PREFIX}claude-sonnet-4-6`],
  ["opus",   `${ANTHROPIC_PREFIX}claude-opus-4-6`],
  ["haiku",  `${ANTHROPIC_PREFIX}claude-haiku-4-5`],
])

No mechanism exists to override this prefix based on user configuration.

Fix

PR #3295 adds claude_code.anthropic_provider config option.

Environment

  • oh-my-opencode: 3.16.0
  • OpenCode with Kiro gateway provider
  • .claude/agents/ from a project with custom .claude/agents/ definitions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions