Skip to content

Running Anthropic models on Azure Foundry results in 404 error #1331

@Herbievorious

Description

@Herbievorious

Describe the bug

Running cagent with an anthropic model in Azure foundry fails with 404.

Azure requires the model name to be e.g. claude-haiku-4-5 but what ends up getting sent to the Azure API is claude-haiku-4-5-20251001 and results in:

error receiving from stream: POST "https://<foundry-project>.ai.azure.com/anthropic/v1/messages": 404 Not Found
{"error":{"code":"DeploymentNotFound","message":"The API deployment claude-haiku-4-5-20251001 does not exist. If you created the deployment within the last 5 minutes,
please wait a moment and try again.","details":"The API deployment claude-haiku-4-5-20251001 does not exist. If you created the deployment within the last 5 minutes,
please wait a moment and try again."}}

This works with v1.18.7

I think the following commit broke running anthropic models on azure foundry:
21e2e4d

Specifically, the call to config.ResolveModelAliases(ctx, cfg) in pkg/teamloader.go:
https://github.com/docker/cagent/blob/main/pkg/teamloader/teamloader.go#L89

Version affected

Please include the version of the software that you are using.
v1.18.8

How To Reproduce

Detailed steps to reproduce the behavior:

Create a basic agent:

#!/usr/bin/env cagent run
version: "2"

agents:
  root:
    model: azure-haiku
    description: A helpful AI assistant
    instruction: |
      You are a knowledgeable assistant that helps users with various tasks.
      Be helpful, accurate, and concise in your responses.

models:
  azure-haiku:
    provider: anthropic
    model: claude-haiku-4-5
    base_url: https://<azure-foundry>.services.ai.azure.com/anthropic

Set up claude-haiku-4-5 model in Azure Foundry.
Set the ANTHROPIC_API_KEY env var.

Run:

cagent run basic.yml "What's 2+2?"

Expectation

Expected to see the AI respond to the question and not respond with a 404

OS and Terminal type

macOS 26.1 (25B78) - Warp.dev

Additional context

I'm happy to contribute to fix this issue with a bit of guidance.

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions