Skip to content

AgentSDK and OpenRouter with Anthropic gives error #347

@jamesmurdza

Description

@jamesmurdza
agent = ComputerAgent(
    model="openrouter/anthropic/claude-sonnet-4",
    tools=[computer],
    max_retries=0,
    verbosity="INFO",
)

gives the error:

raise BadRequestError( litellm.exceptions.BadRequestError: litellm.BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{"type":"error","error":{"type":"invalid_request_error","message":"tool_choice may only be specified while providing tools."}}","provider_name":"Anthropic"}},"user_id":"user_2yQGELhZHDx79ZY0bzj4Hel6Bm4"} LiteLLM Retried: 3 times

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions