Developer Tools

llama.cpp v9977 fixes image loss in Anthropic-to-OpenAI tool conversions

Multimodal tool outputs (images) were silently dropped—now properly converted for OpenAI API.

Deep Dive

llama.cpp's latest release (b9977) addresses a subtle but impactful bug in its server component: during Anthropic-to-OpenAI API conversion, image blocks inside tool_result content were silently discarded. This meant any tool that returned an image (e.g., a vision model generating a chart) would lose the image when passed to the OpenAI-compatible endpoint, breaking multimodal workflows.

The fix modifies `server_chat_convert_anthropic_to_oai()` to properly handle image blocks. When a tool_result contains image blocks, they are now converted to OpenAI's multimodal content parts—a text + image_url array—ensuring the model receives the image. Plain-text results remain unchanged for backward compatibility. The release also includes a test to prevent regression. This update is particularly relevant for developers running local LLM servers that bridge Anthropic and OpenAI tool formats, enabling seamless multimodal agent interactions.

Key Points
  • Silent drop of image blocks in Anthropic tool_result during conversion to OpenAI format fixed.
  • Now converts images to OpenAI multimodal content parts (text + image_url array).
  • Backward compatible: plain-text tool results remain simple strings; tests added.

Why It Matters

Enables reliable multimodal tool use in local LLM servers, critical for agentic workflows with images.

📬 Get the top 10 AI stories daily