initiale version
This commit is contained in:
30
CLAUDE.md
Normal file
30
CLAUDE.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# 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
|
||||
|
||||
```bash
|
||||
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, sets `num_ctx: 131072` and `think: 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 with `qwen3.6:35b-a3b-q4_K_M`.
|
||||
|
||||
## Notable Details
|
||||
|
||||
- The proxy strips `think` from Ollama requests (hardcoded `false`).
|
||||
- Tool call arguments are parsed and sent as a single `partial_json` delta.
|
||||
- Request IDs use `Date.now()` for logging correlation.
|
||||
- A backup of the previous version is saved as `app.js.v10`.
|
||||
Reference in New Issue
Block a user