anthropic_ollama_compatibilityTier 1 · 70% confidence

ai-agents-anthropic-ollama-com-when-routing-anthropic-api-requests-e-g-from-claud-ffca555a

agent: ai_agents

When does this happen?

IF When routing Anthropic API requests (e.g., from Claude Code) to an Ollama model via LiteLLM, completions fail with HTTP 500 and AttributeError: 'str' object has no attribute 'get'.

How others solved it

THEN Upgrade LiteLLM to a version that includes a fix for the 'str' object has no attribute 'get' error in the Ollama prompt handler. As a temporary workaround, disable tool-use by setting `supports_function_calling: false` in the model's `model_info` under `litellm_params` to avoid the message conversion that triggers the bug. If possible, ensure the Anthropic client sends message content as a list of content blocks (e.g., `content: [{"type": "text", "text": "..."}]`) rather than a plain string.

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics