1.5 KiB
1.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A single-file Express.js proxy (app.js) that translates Anthropic API (/v1/messages) requests to an Ollama API backend. It enables Claude SDK clients to route through this proxy to a local/remote Ollama instance at https://ollama.aquantico.de.
Running
node app.js
The proxy listens on port 11435. No build step, lint, or test infrastructure exists.
Key Architecture
app.js— Single entry point. All logic is in one file.convertAnthropicToOllama()— Transforms Anthropic request body into Ollama format: maps system messages, converts content blocks (text + tool_results), sanitizes tool schemas, setsnum_ctx: 131072andthink: false.handleResponse()— Reads Ollama's SSE stream and re-emits it as Anthropic-compatible SSE events (message_start,content_block_start,content_block_delta,content_block_stop,message_delta,message_stop).convertAnthropicTools()— Strips invalid fields from Anthropic tool schemas and normalizes them to Ollama's function-call format.- Model names starting with
claude-are silently replaced withqwen3.6:35b-a3b-q4_K_M.
Notable Details
- The proxy strips
thinkfrom Ollama requests (hardcodedfalse). - Tool call arguments are parsed and sent as a single
partial_jsondelta. - Request IDs use
Date.now()for logging correlation. - A backup of the previous version is saved as
app.js.v10.