Skip to content

agent mode: APIError #239

@yennor

Description

@yennor

Issue

I've just wanted to try out agent mode:

aider-ce --model openrouter/anthropic/claude-sonnet-4.5 --agent
what ever i write, it results in:

LiteLLM API Error: litellm.BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"A maximum of 4 blocks with cache_control may be provided. Found 7.\"},\"request_id\":\"req_011CVuxStX4ojGj47gXdCvJM\"}","provider_name":"Anthropic"}},"user_id":"user_30YqKDHrYOuabrJeyr0BQO3afyE"}
litellm.APIError: Error building chunks for logging/streaming usage calculation
Retrying in 0.2 seconds...
LiteLLM API Error: litellm.BadRequestError: OpenrouterException - {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"A maximum of 4 blocks with cache_control may be provided. Found 7.\"},\"request_id\":\"req_vrtx_011CVuxT7aPAEnhZ7Qjjxnpg\"}","provider_name":"Google"}},"user_id":"user_30YqKDHrYOuabrJeyr0BQO3afyE"}
litellm.APIError: Error building chunks for logging/streaming usage calculation
Retrying in 0.5 seconds...

Version and model info

Aider 0.86.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions