-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Initial Checks
- I'm using the latest version of Pydantic AI
- I've searched for my issue in the issue tracker before opening this issue
Description
We’re seeing 404 errors for every Anthropic model when accessed via Pydantic AI Gateway. Example:
Command:
uv run --env-file .env python temp2.py
Error:
pydantic_ai.exceptions.ModelHTTPError: status_code: 404, model_name: claude-sonnet-4-0, body: {'error': {'code': 404, 'message': 'Publisher Model `projects/vertexai-485114/locations/europe-west8/publishers/anthropic/models/claude-sonnet-4` not found.', 'status': 'NOT_FOUND'}}
This happens for all Anthropic models via gateway.
Control cases succeed:
- Direct Anthropic (no gateway) works (
temp.py). - Direct Anthropic with key from .env works (
temp3.py). - Gateway OpenAI works (
temp4.py). - Gateway Google Vertex works (another script in our codebase, not shown here).
We verified with more than one gateway API key.
Environment variables in .env (keys omitted):
ANTHROPIC_API_KEY=...PYDANTIC_AI_GATEWAY_API_KEY=...
Gateway provider settings for Anthropic:
- Base URL: https://api.anthropic.com
- Slug: anthropic-temp-egon-personal
- Provider Type: Anthropic
- Inject Cost: Enabled
- Block on Error: False
- Created: 23/01/2026, 10:35:58
- Credentials: (redacted)
Expected: Anthropic models should run via gateway just like OpenAI and Vertex.
Minimal, Reproducible Example
# Minimal, Reproducible Example (fails)
from pydantic_ai import Agent
agent = Agent(
"gateway/anthropic:claude-sonnet-4-0",
instructions="Be concise, reply with one sentence.",
)
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
Run with:
uv run --env-file .env python temp2.py
---
#**Control examples (work)**
# 1) Direct Anthropic (no gateway) — works
from pydantic_ai import Agent
from pydantic_ai.models.anthropic import AnthropicModel
from pydantic_ai.providers.anthropic import AnthropicProvider
model = AnthropicModel("claude-haiku-4-5", provider=AnthropicProvider(api_key="***"))
agent = Agent(model, instructions="Be concise, reply with one sentence.")
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
Run with:
uv run --env-file .env python temp1.py
# 2) Direct Anthropic (no gateway) — works
from pydantic_ai import Agent
agent = Agent(
"anthropic:claude-sonnet-4-0",
instructions="Be concise, reply with one sentence.",
)
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
Run with:
uv run --env-file .env python temp3.py
# 3) Gateway OpenAI — works
from pydantic_ai import Agent
agent = Agent(
"gateway/openai:gpt-4-turbo",
instructions="Be concise, reply with one sentence.",
)
result = agent.run_sync('Where does "hello world" come from?')
print(result.output)
Run with:
uv run --env-file .env python temp4.pyLogfire Trace
Python, Pydantic AI & LLM client version
- Python: Python 3.13.11
- Pydantic AI: 1.41.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working