Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.82 KB

File metadata and controls

66 lines (42 loc) · 1.82 KB

anthropic-image-proxy

Fixes Claude Code image reading with non-Anthropic model servers (llama-server, vLLM, Ollama, etc.).

The problem

Claude Code's Read tool sends images inside tool_result content blocks. Non-Anthropic providers silently drop images from tool results — your model never sees screenshots, diagrams, or any image the agent reads from disk.

Clipboard paste works because it puts images in user message content. This proxy applies the same fix to tool results automatically.

Install

npx anthropic-image-proxy --target http://localhost:8080

Requires Node.js 18+.

Usage

# Start the proxy (in one terminal)
npx anthropic-image-proxy --target http://localhost:8080

# Point Claude Code at the proxy (in another terminal)
ANTHROPIC_BASE_URL=http://localhost:3456 claude

That's it. Images from the Read tool, Bash tool, and notebooks now work.

Options

Flag Default Description
--target <url> (required) Your model server URL
--port <number> 3456 Port the proxy listens on
--verbose false Log when images are promoted

How it works

The proxy intercepts POST /v1/messages requests and moves image content blocks from inside tool_result blocks to user message level, where providers handle them correctly.

Before (model server drops the image):

tool_result.content → [{ type: "image", ... }]

After (model server sees the image):

message.content → [tool_result, { type: "image", ... }]

Everything else passes through untouched. Responses are never modified.

Tested with

  • llama-server (llama.cpp) with Anthropic-compatible endpoint
  • Claude Code with --api-url / ANTHROPIC_BASE_URL

Integrations

See docs/integration.md for integration guides.

License

MIT