initiale version

This commit is contained in:
2026-05-10 10:46:41 +02:00
commit deb0d5de9d
10 changed files with 2049 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/

30
CLAUDE.md Normal file
View 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`.

451
app.js Normal file
View File

@@ -0,0 +1,451 @@
// proxy.js - KOMPLETT, mit Tool-Call-Deduplizierung
const express = require('express');
const app = express();
const colors = {
reset: '\x1b[0m',
cyan: '\x1b[36m',
green: '\x1b[32m',
magenta: '\x1b[35m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
red: '\x1b[31m'
};
app.use(express.json({ limit: '50mb' }));
function sanitizeToolSchema(schema) {
if (!schema || typeof schema !== 'object') {
return { type: 'object', properties: {} };
}
const clean = JSON.parse(JSON.stringify(schema));
if (!clean.type) clean.type = 'object';
if (!clean.properties) clean.properties = {};
return clean;
}
function convertAnthropicTools(anthropicTools) {
if (!anthropicTools || anthropicTools.length === 0) return [];
const validTools = [];
for (const tool of anthropicTools) {
try {
const ollamaTool = {
type: 'function',
function: {
name: tool.name,
description: (tool.description || '').substring(0, 500),
parameters: sanitizeToolSchema(tool.input_schema)
}
};
JSON.stringify(ollamaTool);
validTools.push(ollamaTool);
} catch (e) {
console.error(`${colors.red}[Tool Schema Error] ${e.message}${colors.reset}`);
}
}
return validTools;
}
function stringifyToolResultContent(content) {
if (Array.isArray(content)) {
return content
.map(c => {
if (typeof c === 'string') return c;
if (c?.text) return c.text;
return JSON.stringify(c);
})
.join('\n');
}
if (typeof content === 'string') return content;
return JSON.stringify(content);
}
// BUG 3 FIX: tool_use → Ollama tool_calls, tool_result → role:tool
function convertAnthropicToOllama(anthropicBody) {
const ollamaMessages = [];
if (anthropicBody.system) {
ollamaMessages.push({
role: 'system',
content:
typeof anthropicBody.system === 'string'
? anthropicBody.system
: JSON.stringify(anthropicBody.system)
});
}
for (const msg of anthropicBody.messages || []) {
if (typeof msg.content === 'string') {
ollamaMessages.push({ role: msg.role, content: msg.content });
continue;
}
if (!Array.isArray(msg.content)) continue;
if (msg.role === 'assistant') {
const textParts = [];
const toolCalls = [];
for (const item of msg.content) {
if (item.type === 'text') {
textParts.push(item.text || '');
} else if (item.type === 'tool_use') {
toolCalls.push({
function: {
name: item.name,
arguments: item.input || {}
}
});
}
}
const assistantMsg = { role: 'assistant', content: textParts.join('\n\n') };
if (toolCalls.length > 0) {
assistantMsg.tool_calls = toolCalls;
}
ollamaMessages.push(assistantMsg);
} else {
// user messages: text bleibt als user, tool_result wird zu role:tool
const pendingText = [];
for (const item of msg.content) {
if (item.type === 'text') {
pendingText.push(item.text || '');
} else if (item.type === 'tool_result') {
if (pendingText.length > 0) {
ollamaMessages.push({ role: 'user', content: pendingText.join('\n\n') });
pendingText.length = 0;
}
const resultText = stringifyToolResultContent(item.content);
console.log(`${colors.blue}📥 Tool Result ${item.tool_use_id}:${colors.reset}`);
console.log(`${colors.blue}${resultText}${colors.reset}`);
console.log('');
ollamaMessages.push({ role: 'tool', content: resultText });
}
}
if (pendingText.length > 0) {
ollamaMessages.push({ role: 'user', content: pendingText.join('\n\n') });
}
}
}
const ollamaBody = {
model: anthropicBody.model,
messages: ollamaMessages,
stream: anthropicBody.stream !== false,
think: false,
options: {
temperature: 0.7,
num_predict: anthropicBody.max_tokens || 4096,
num_ctx: 262144
}
};
if (anthropicBody.tools && anthropicBody.tools.length > 0) {
const validTools = convertAnthropicTools(anthropicBody.tools);
if (validTools.length > 0) {
ollamaBody.tools = validTools;
}
}
return ollamaBody;
}
function parseToolArguments(args) {
if (!args) return {};
if (typeof args === 'string') {
try {
return JSON.parse(args);
} catch (e) {
console.error(`${colors.red}[Tool Args Parse Error] ${e.message}${colors.reset}`);
return {};
}
}
if (typeof args === 'object') {
return args;
}
return {};
}
function makeToolDedupeKey(tc) {
const name = tc.function?.name || '';
const args = tc.function?.arguments || {};
const argsString = typeof args === 'string' ? args : JSON.stringify(args);
return `${name}:${argsString}`;
}
async function handleResponse(response, anthropicBody, res, requestNum) {
res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Cache-Control', 'no-cache');
res.setHeader('Connection', 'keep-alive');
const messageId = 'msg_' + requestNum;
// BUG 2 FIX: usage.input_tokens und stop_reason hinzugefügt
res.write(`event: message_start\ndata: ${JSON.stringify({
type: 'message_start',
message: {
id: messageId,
type: 'message',
role: 'assistant',
content: [],
model: anthropicBody.model,
stop_reason: null,
stop_sequence: null,
usage: { input_tokens: 0, output_tokens: 0 }
}
})}\n\n`);
const reader = response.body.getReader();
const decoder = new TextDecoder();
let contentBlocks = [];
let currentBlockIndex = 0;
const seenToolCalls = new Set();
let emittedToolUse = false;
let messageFinished = false;
let buffer = '';
// BUG 1 FIX: Chunk-Verarbeitung als Funktion, damit final buffer ebenfalls verarbeitet wird
function processChunk(data) {
if (messageFinished) return;
if (data.message?.tool_calls && data.message.tool_calls.length > 0) {
for (const tc of data.message.tool_calls) {
const dedupeKey = makeToolDedupeKey(tc);
if (seenToolCalls.has(dedupeKey)) {
console.log(`${colors.yellow}[Duplicate Tool Call skipped] ${dedupeKey}${colors.reset}`);
continue;
}
seenToolCalls.add(dedupeKey);
emittedToolUse = true;
const toolName = tc.function?.name;
const toolInput = parseToolArguments(tc.function?.arguments);
const toolUseId = `toolu_${requestNum}_${currentBlockIndex}`;
console.log(`${colors.yellow}[Raw Tool Call] ${JSON.stringify(tc)}${colors.reset}`);
console.log(`${colors.magenta}[Sending Tool Use: ${toolName}]${colors.reset}`);
console.log(`${colors.magenta}Input: ${JSON.stringify(toolInput)}${colors.reset}`);
res.write(`event: content_block_start\ndata: ${JSON.stringify({
type: 'content_block_start',
index: currentBlockIndex,
content_block: {
type: 'tool_use',
id: toolUseId,
name: toolName,
input: {}
}
})}\n\n`);
res.write(`event: content_block_delta\ndata: ${JSON.stringify({
type: 'content_block_delta',
index: currentBlockIndex,
delta: {
type: 'input_json_delta',
partial_json: JSON.stringify(toolInput)
}
})}\n\n`);
res.write(`event: content_block_stop\ndata: ${JSON.stringify({
type: 'content_block_stop',
index: currentBlockIndex
})}\n\n`);
currentBlockIndex++;
}
}
if (data.message?.content) {
const text = data.message.content;
if (contentBlocks[currentBlockIndex] === undefined) {
res.write(`event: content_block_start\ndata: ${JSON.stringify({
type: 'content_block_start',
index: currentBlockIndex,
content_block: {
type: 'text',
text: ''
}
})}\n\n`);
contentBlocks[currentBlockIndex] = '';
}
process.stdout.write(`${colors.green}${text}${colors.reset}`);
res.write(`event: content_block_delta\ndata: ${JSON.stringify({
type: 'content_block_delta',
index: currentBlockIndex,
delta: {
type: 'text_delta',
text
}
})}\n\n`);
contentBlocks[currentBlockIndex] += text;
}
if (data.done) {
messageFinished = true;
if (contentBlocks[currentBlockIndex] !== undefined) {
res.write(`event: content_block_stop\ndata: ${JSON.stringify({
type: 'content_block_stop',
index: currentBlockIndex
})}\n\n`);
}
res.write(`event: message_delta\ndata: ${JSON.stringify({
type: 'message_delta',
delta: {
stop_reason: emittedToolUse ? 'tool_use' : 'end_turn'
},
usage: {
output_tokens: data.eval_count || 0
}
})}\n\n`);
res.write(`event: message_stop\ndata: ${JSON.stringify({
type: 'message_stop'
})}\n\n`);
console.log(`${colors.green}${colors.reset}\n`);
}
}
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split('\n');
buffer = lines.pop() || '';
for (const line of lines) {
const trimmed = line.trim();
if (!trimmed) continue;
try {
processChunk(JSON.parse(trimmed));
} catch (e) {
console.error(`${colors.red}[Stream Parse Error] ${e.message}${colors.reset}`);
console.error(`${colors.red}${line}${colors.reset}`);
}
}
}
// BUG 1 FIX: letzten gepufferten Chunk verarbeiten (kein \n am Ende)
if (buffer.trim()) {
try {
processChunk(JSON.parse(buffer.trim()));
} catch (e) {
console.error(`${colors.red}[Final Buffer Parse Error] ${e.message}${colors.reset}`);
console.error(buffer);
}
}
if (!messageFinished) {
if (contentBlocks[currentBlockIndex] !== undefined) {
res.write(`event: content_block_stop\ndata: ${JSON.stringify({
type: 'content_block_stop',
index: currentBlockIndex
})}\n\n`);
}
res.write(`event: message_delta\ndata: ${JSON.stringify({
type: 'message_delta',
delta: {
stop_reason: emittedToolUse ? 'tool_use' : 'end_turn'
},
usage: {
output_tokens: 0
}
})}\n\n`);
res.write(`event: message_stop\ndata: ${JSON.stringify({
type: 'message_stop'
})}\n\n`);
}
res.end();
}
app.post('/v1/messages', async (req, res) => {
const requestNum = Date.now();
console.log(`${colors.magenta}━━━ #${requestNum} ━━━${colors.reset}`);
try {
const anthropicBody = req.body;
if (anthropicBody.model?.startsWith('claude-')) {
anthropicBody.model = 'qwen3.6:35b-a3b-q4_K_M';
}
const ollamaBody = convertAnthropicToOllama(anthropicBody);
console.log(
`${colors.magenta}[msgs=${ollamaBody.messages.length}, tools=${ollamaBody.tools?.length || 0}, ctx=256k, think=false]${colors.reset}`
);
const response = await fetch('https://ollama.aquantico.de/api/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer 324GF44-50AA-4B57-9386-K435DLJ764DFR'
},
body: JSON.stringify(ollamaBody)
});
if (!response.ok) {
const errorText = await response.text();
console.error(`${colors.red}${errorText}${colors.reset}`);
throw new Error(`Ollama: ${response.status}`);
}
return handleResponse(response, anthropicBody, res, requestNum);
} catch (error) {
console.error(`${colors.red}${error.message}${colors.reset}`);
if (!res.headersSent) {
res.status(500).json({
type: 'error',
error: {
type: 'api_error',
message: error.message
}
});
} else {
res.end();
}
}
});
app.listen(11435, () => {
console.log(`${colors.magenta}Proxy: localhost:11435 (256k ctx, think=false)${colors.reset}\n`);
});

290
app.js.v10 Normal file
View File

@@ -0,0 +1,290 @@
// proxy.js - KOMPLETT
const express = require('express');
const app = express();
const colors = {
reset: '\x1b[0m',
cyan: '\x1b[36m',
green: '\x1b[32m',
magenta: '\x1b[35m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
red: '\x1b[31m'
};
app.use(express.json({ limit: '50mb' }));
function sanitizeToolSchema(schema) {
if (!schema || typeof schema !== 'object') {
return { type: 'object', properties: {} };
}
const clean = JSON.parse(JSON.stringify(schema));
if (!clean.type) clean.type = 'object';
if (!clean.properties) clean.properties = {};
return clean;
}
function convertAnthropicTools(anthropicTools) {
if (!anthropicTools || anthropicTools.length === 0) return [];
const validTools = [];
for (const tool of anthropicTools) {
try {
const ollamaTool = {
type: 'function',
function: {
name: tool.name,
description: (tool.description || '').substring(0, 500),
parameters: sanitizeToolSchema(tool.input_schema)
}
};
JSON.stringify(ollamaTool);
validTools.push(ollamaTool);
} catch (e) {}
}
console.log(`${colors.yellow}Tools: ${validTools.length}${colors.reset}`);
return validTools;
}
function convertAnthropicToOllama(anthropicBody) {
const ollamaMessages = [];
if (anthropicBody.system) {
ollamaMessages.push({
role: 'system',
content: typeof anthropicBody.system === 'string'
? anthropicBody.system
: JSON.stringify(anthropicBody.system)
});
}
for (const msg of anthropicBody.messages) {
if (typeof msg.content === 'string') {
ollamaMessages.push({ role: msg.role, content: msg.content });
} else if (Array.isArray(msg.content)) {
const parts = [];
for (const item of msg.content) {
if (item.type === 'text') {
parts.push(item.text);
} else if (item.type === 'tool_result') {
const resultText = Array.isArray(item.content)
? item.content.map(c => c.text || JSON.stringify(c)).join('\n')
: typeof item.content === 'string' ? item.content : JSON.stringify(item.content);
console.log(`${colors.blue}📥 ${item.tool_use_id}:${colors.reset}`);
console.log(`${colors.blue}${resultText}${colors.reset}`);
console.log('');
parts.push(`Tool Result (${item.tool_use_id}):\n${resultText}`);
}
}
if (parts.length > 0) {
ollamaMessages.push({ role: msg.role, content: parts.join('\n\n') });
}
}
}
const ollamaBody = {
model: anthropicBody.model,
messages: ollamaMessages,
stream: anthropicBody.stream !== false,
think: false, // AUF TOP-LEVEL!
options: {
temperature: 0.7,
num_predict: anthropicBody.max_tokens || 4096,
num_ctx: 131072
}
};
if (anthropicBody.tools && anthropicBody.tools.length > 0) {
const validTools = convertAnthropicTools(anthropicBody.tools);
if (validTools.length > 0) {
ollamaBody.tools = validTools;
}
}
return ollamaBody;
}
async function handleResponse(response, anthropicBody, res, requestNum) {
res.setHeader('Content-Type', 'text/event-stream');
const messageId = 'msg_' + requestNum;
res.write(`event: message_start\ndata: ${JSON.stringify({
type: 'message_start',
message: { id: messageId, type: 'message', role: 'assistant', content: [], model: anthropicBody.model }
})}\n\n`);
const reader = response.body.getReader();
const decoder = new TextDecoder();
let contentBlocks = [];
let currentBlockIndex = 0;
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value, { stream: true });
const lines = chunk.split('\n').filter(line => line.trim());
for (const line of lines) {
try {
const data = JSON.parse(line);
console.log(`${colors.cyan}[Ollama Response] ${JSON.stringify(data).substring(0, 200)}${colors.reset}`);
if (data.message?.tool_calls && data.message.tool_calls.length > 0) {
for (const tc of data.message.tool_calls) {
console.log(`${colors.yellow}[Raw Tool Call] ${JSON.stringify(tc)}${colors.reset}`);
let toolInput = {};
if (typeof tc.function.arguments === 'string') {
try {
toolInput = JSON.parse(tc.function.arguments);
} catch (e) {
console.error(`${colors.red}Parse error: ${e.message}${colors.reset}`);
}
} else if (typeof tc.function.arguments === 'object') {
toolInput = tc.function.arguments;
}
const toolUseId = `toolu_${requestNum}_${currentBlockIndex}`;
console.log(`${colors.magenta}[Sending Tool Use: ${tc.function.name}]${colors.reset}`);
console.log(`${colors.magenta}Input: ${JSON.stringify(toolInput)}${colors.reset}`);
// 1. content_block_start mit LEEREM Input
res.write(`event: content_block_start\ndata: ${JSON.stringify({
type: 'content_block_start',
index: currentBlockIndex,
content_block: {
type: 'tool_use',
id: toolUseId,
name: tc.function.name,
input: {} // LEER - wird über Delta gesendet!
}
})}\n\n`);
// 2. Input als Delta senden
const inputJson = JSON.stringify(toolInput);
res.write(`event: content_block_delta\ndata: ${JSON.stringify({
type: 'content_block_delta',
index: currentBlockIndex,
delta: {
type: 'input_json_delta',
partial_json: inputJson
}
})}\n\n`);
// 3. content_block_stop
res.write(`event: content_block_stop\ndata: ${JSON.stringify({
type: 'content_block_stop',
index: currentBlockIndex
})}\n\n`);
currentBlockIndex++;
}
}
if (data.message?.content) {
const text = data.message.content;
if (contentBlocks[currentBlockIndex] === undefined) {
res.write(`event: content_block_start\ndata: ${JSON.stringify({
type: 'content_block_start',
index: currentBlockIndex,
content_block: { type: 'text', text: '' }
})}\n\n`);
contentBlocks[currentBlockIndex] = '';
}
process.stdout.write(`${colors.green}${text}${colors.reset}`);
res.write(`event: content_block_delta\ndata: ${JSON.stringify({
type: 'content_block_delta',
index: currentBlockIndex,
delta: { type: 'text_delta', text: text }
})}\n\n`);
contentBlocks[currentBlockIndex] += text;
}
if (data.done) {
if (contentBlocks[currentBlockIndex] !== undefined) {
res.write(`event: content_block_stop\ndata: ${JSON.stringify({
type: 'content_block_stop',
index: currentBlockIndex
})}\n\n`);
}
res.write(`event: message_delta\ndata: ${JSON.stringify({
type: 'message_delta',
delta: { stop_reason: 'end_turn' },
usage: { output_tokens: data.eval_count || 0 }
})}\n\n`);
res.write(`event: message_stop\ndata: ${JSON.stringify({
type: 'message_stop'
})}\n\n`);
console.log(`${colors.green}✓${colors.reset}\n`);
}
} catch (e) {
console.error(`${colors.red}Error: ${e.message}${colors.reset}`);
}
}
}
res.end();
}
app.post('/v1/messages', async (req, res) => {
const requestNum = Date.now();
console.log(`${colors.magenta}━━━ #${requestNum} ━━━${colors.reset}`);
try {
const anthropicBody = req.body;
if (anthropicBody.model?.startsWith('claude-')) {
anthropicBody.model = 'qwen3.6:35b-a3b-q4_K_M';
}
const ollamaBody = convertAnthropicToOllama(anthropicBody);
console.log(`${colors.magenta}[msgs=${ollamaBody.messages.length}, tools=${ollamaBody.tools?.length || 0}, ctx=128k, think=false]${colors.reset}`);
const response = await fetch('https://ollama.aquantico.de/api/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer 324GF44-50AA-4B57-9386-K435DLJ764DFR'
},
body: JSON.stringify(ollamaBody)
});
if (!response.ok) {
const errorText = await response.text();
console.error(`${colors.red}${errorText}${colors.reset}`);
throw new Error(`Ollama: ${response.status}`);
}
return handleResponse(response, anthropicBody, res, requestNum);
} catch (error) {
console.error(`${colors.red}${error.message}${colors.reset}`);
res.status(500).json({
type: 'error',
error: { type: 'api_error', message: error.message }
});
}
});
app.listen(11435, () => {
console.log(`${colors.magenta}Proxy: localhost:11435 (128k ctx, think=false)${colors.reset}\n`);
});

7
claude-via-proxy.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
# Claude Code über lokalen noThinkProxy starten
# Voraussetzung: Proxy läuft bereits auf localhost:11435
export ANTHROPIC_BASE_URL=http://localhost:11435
exec claude "$@"

164
doc/anthropic-api.md Normal file
View File

@@ -0,0 +1,164 @@
# Anthropic Messages API
Endpoint: `POST /v1/messages`
Docs: https://docs.anthropic.com/en/api/messages
## Request
```json
{
"model": "claude-opus-4-7",
"max_tokens": 4096,
"messages": [
{
"role": "user",
"content": "string OR array of content blocks"
}
],
"system": "string OR array of system blocks",
"temperature": 0.7,
"stop_sequences": ["---"],
"tools": [
{
"name": "tool_name",
"description": "What this tool does",
"input_schema": {
"type": "object",
"properties": {
"param": { "type": "string", "description": "..." }
},
"required": ["param"]
}
}
],
"tool_choice": { "type": "auto" },
"stream": true
}
```
### Fields
| Field | Type | Required | Notes |
|------------------|--------------|----------|---------------------------------------------------|
| `model` | string | Yes | e.g. `claude-opus-4-7`, `claude-sonnet-4-6` |
| `max_tokens` | number | Yes | Max output tokens |
| `messages` | array | Yes | `role: user|assistant` |
| `system` | string/array | No | System prompt (separate from messages) |
| `temperature` | number | No | 0.01.0 |
| `stop_sequences` | array | No | Strings that stop generation |
| `tools` | array | No | Tool definitions with `input_schema` (JSON Schema)|
| `tool_choice` | object | No | `{ type: "auto|any|tool", name?: "..." }` |
| `stream` | boolean | No | Enable SSE streaming |
## Message Content Types
```json
{ "type": "text", "text": "string" }
{ "type": "image", "source": { "type": "base64", "media_type": "image/jpeg", "data": "..." } }
{ "type": "tool_use", "id": "toolu_abc", "name": "tool_name", "input": {} }
{ "type": "tool_result", "tool_use_id": "toolu_abc", "content": "result string or array" }
```
## Streaming SSE Events
SSE format: each event is two lines `event: <type>\ndata: <json>` followed by blank line.
### Event Order
1. `message_start`
2. For each content block: `content_block_start` → N× `content_block_delta``content_block_stop`
3. `message_delta`
4. `message_stop`
Interspersed `ping` events may appear at any time.
### message_start
```json
{
"type": "message_start",
"message": {
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"model": "claude-opus-4-7",
"content": [],
"stop_reason": null,
"stop_sequence": null,
"usage": { "input_tokens": 25, "output_tokens": 1 }
}
}
```
### content_block_start
```json
{ "type": "content_block_start", "index": 0,
"content_block": { "type": "text", "text": "" } }
{ "type": "content_block_start", "index": 1,
"content_block": { "type": "tool_use", "id": "toolu_abc", "name": "get_weather", "input": {} } }
```
### content_block_delta
```json
{ "type": "content_block_delta", "index": 0,
"delta": { "type": "text_delta", "text": "Hello" } }
{ "type": "content_block_delta", "index": 1,
"delta": { "type": "input_json_delta", "partial_json": "{\"loc" } }
```
### content_block_stop
```json
{ "type": "content_block_stop", "index": 0 }
```
### message_delta
```json
{
"type": "message_delta",
"delta": {
"stop_reason": "end_turn",
"stop_sequence": null
},
"usage": { "output_tokens": 15 }
}
```
`stop_reason` values: `end_turn` | `stop_sequence` | `max_tokens` | `tool_use`
### message_stop
```json
{ "type": "message_stop" }
```
## Non-Streaming Response
```json
{
"id": "msg_abc",
"type": "message",
"role": "assistant",
"model": "claude-opus-4-7",
"content": [
{ "type": "text", "text": "Hello!" },
{ "type": "tool_use", "id": "toolu_abc", "name": "get_weather", "input": { "location": "Berlin" } }
],
"stop_reason": "tool_use",
"stop_sequence": null,
"usage": { "input_tokens": 100, "output_tokens": 50 }
}
```
## Tool Flow
1. Send request with `tools` array
2. Model responds with `stop_reason: "tool_use"` and `content` block of `type: "tool_use"`
3. Execute the tool locally
4. Send next user message with `type: "tool_result"` content block referencing `tool_use_id`
5. Continue until `stop_reason: "end_turn"`

125
doc/ollama-api.md Normal file
View File

@@ -0,0 +1,125 @@
# Ollama Chat API
Endpoint: `POST /api/chat`
## Request
```json
{
"model": "llama3.2",
"messages": [
{ "role": "system", "content": "string" },
{ "role": "user", "content": "string" },
{ "role": "assistant", "content": "string" },
{ "role": "tool", "content": "string" }
],
"tools": [
{
"type": "function",
"function": {
"name": "string",
"description": "string",
"parameters": {
"type": "object",
"properties": { "param": { "type": "string", "description": "..." } },
"required": ["param"]
}
}
}
],
"think": false,
"format": "json",
"stream": true,
"keep_alive": "5m",
"options": {
"temperature": 0.7,
"num_ctx": 131072,
"num_predict": 4096
}
}
```
### Fields
| Field | Type | Required | Notes |
|--------------|---------|----------|------------------------------------------------|
| `model` | string | Yes | Model name (e.g. `qwen3.6:35b-a3b-q4_K_M`) |
| `messages` | array | Yes | Conversation history |
| `tools` | array | No | Function definitions (OpenAI-compatible format)|
| `think` | boolean | No | Enable chain-of-thought (thinking models only) |
| `format` | string | No | `"json"` or JSON schema for structured output |
| `stream` | boolean | No | Default: `true` |
| `keep_alive` | string | No | How long to keep model loaded. Default: `5m` |
| `options` | object | No | Model runtime parameters |
## Streaming Response (NDJSON)
Each line is a standalone JSON object:
```json
{ "model": "...", "message": { "role": "assistant", "content": "partial text" }, "done": false }
```
Final line (done):
```json
{
"model": "...",
"message": { "role": "assistant", "content": "" },
"done": true,
"done_reason": "stop",
"total_duration": 1234567890,
"load_duration": 987654321,
"prompt_eval_count": 50,
"eval_count": 200,
"eval_duration": 12345678
}
```
### Tool Call Response
When the model decides to use a tool, `message.tool_calls` is set (content is empty/null):
```json
{
"model": "...",
"message": {
"role": "assistant",
"content": "",
"tool_calls": [
{
"function": {
"name": "get_weather",
"arguments": { "location": "Berlin", "unit": "celsius" }
}
}
]
},
"done": false
}
```
Note: `tool_calls[].function.arguments` is an **object** (already parsed JSON), not a string.
### done_reason Values
| Value | Meaning |
|---------------|----------------------------------|
| `stop` | Natural end of generation |
| `tool_calls` | Model triggered a tool call |
| `load` | Model was loaded |
| `unload` | Model was unloaded |
## Tool Result Message
After receiving a tool call, send result as role `tool`:
```json
{
"role": "tool",
"content": "result text or JSON string"
}
```
## Non-Streaming Response
Single JSON object with all fields combined (same structure as final streaming line).

131
doc/proxy-analysis.md Normal file
View File

@@ -0,0 +1,131 @@
# Proxy Implementierungsanalyse
## Was der Proxy macht
Übersetzt **Anthropic API** (`POST /v1/messages`) → **Ollama API** (`POST /api/chat`)
- Empfängt Anthropic SSE-Format
- Gibt Anthropic SSE-Format zurück
- Routing: `localhost:11435``https://ollama.aquantico.de/api/chat`
---
## Korrekte Implementierungen ✓
### 1. Model-Substitution (korrekt)
```js
if (anthropicBody.model?.startsWith('claude-')) {
anthropicBody.model = 'qwen3.6:35b-a3b-q4_K_M';
}
```
Alle `claude-*` Modelle werden durch das lokale Modell ersetzt.
### 2. Think-Modus deaktiviert (korrekt)
```js
think: false
```
Hardcoded in `convertAnthropicToOllama()`.
### 3. Tool-Schema-Konvertierung (korrekt)
Anthropic `input_schema` → Ollama `function.parameters`:
```js
{ type: 'function', function: { name, description, parameters: sanitizeToolSchema(tool.input_schema) } }
```
### 4. Tool-Call-Parsing in Response (korrekt)
Ollama gibt `tc.function.name` und `tc.function.arguments` zurück — genau das liest der Proxy:
```js
const toolName = tc.function?.name;
const toolInput = parseToolArguments(tc.function?.arguments);
```
### 5. SSE-Event-Sequenz (korrekt)
Ausgabe entspricht Anthropic-Spec:
`message_start``content_block_start``content_block_delta``content_block_stop``message_delta``message_stop`
### 6. stop_reason (korrekt)
```js
stop_reason: emittedToolUse ? 'tool_use' : 'end_turn'
```
### 7. Tool-Deduplizierung (korrekt)
Verhindert doppelte Tool-Calls via `seenToolCalls` Set mit Key `name:args`.
---
## Bekannte Bugs / Schwachstellen ⚠️
### BUG 1: Leerer finaler Buffer-Handler (app.js:350-358)
```js
if (buffer.trim()) {
try {
const data = JSON.parse(buffer.trim());
// gleichen Handling-Code wie oben ausführen ← LEER, nie ausgeführt!
} catch (e) { ... }
}
```
**Problem**: Wenn das letzte NDJSON-Chunk von Ollama nicht mit `\n` endet (was bei einigen Ollama-Versionen vorkommt), bleibt die finale `done: true`-Zeile im Buffer und wird nicht verarbeitet.
**Auswirkung**: `messageFinished` bleibt `false`, Fallback-Code (Zeile 360-381) sendet die Abschluss-Events ohne `eval_count` (output_tokens=0).
**Fix**: Den gleichen Parsing-Code aus der while-Schleife in den finalen Buffer-Handler kopieren.
### BUG 2: message_start ohne usage.input_tokens (app.js:200-209)
```js
res.write(`event: message_start\ndata: ${JSON.stringify({
type: 'message_start',
message: {
id: messageId, type: 'message', role: 'assistant', content: [],
model: anthropicBody.model
// fehlt: stop_reason: null, usage: { input_tokens: 0, output_tokens: 0 }
}
})}\n\n`);
```
**Auswirkung**: Anthropic-kompatible Clients erwarten `usage.input_tokens` in `message_start`. Kann bei strikten Clients zu Parse-Fehlern führen.
### BUG 3: tool_use/tool_result als Text im Nachrichten-Verlauf
Wenn Anthropic-Clients `tool_use` (in Assistant-Nachrichten) und `tool_result` (in User-Nachrichten) im History senden, werden diese als Text-Strings in den Ollama-Messages eingebettet:
```
"Previous assistant tool call already made.\nTool name: ...\n..."
```
**Korrekt wäre**: Assistant-Nachrichten mit `tool_calls` senden, Tool-Results als `role: "tool"` Nachricht.
**Auswirkung**: Das Modell versteht den Tool-Call-Verlauf semantisch nicht korrekt. Die bestehende Deduplizierungs-Logik kompensiert dies teilweise.
---
## Architektur-Übersicht
```
Client (Claude SDK)
│ POST /v1/messages (Anthropic Format)
noThinkProxy :11435
│ convertAnthropicToOllama()
│ - system → messages[0] role:system
│ - tool_use → text string
│ - tool_result → text string
│ - model: claude-* → qwen3.6:35b-a3b-q4_K_M
│ - think: false
│ - options: { num_ctx:131072, num_predict, temperature:0.7 }
│ POST /api/chat (Ollama NDJSON)
Ollama https://ollama.aquantico.de
│ NDJSON stream: {message:{content, tool_calls}, done}
noThinkProxy
│ handleResponse()
│ - text → content_block_delta (text_delta)
│ - tool_calls → content_block_start/delta/stop (tool_use)
│ - done → message_delta + message_stop
Client (Anthropic SSE)
```

844
package-lock.json generated Normal file
View File

@@ -0,0 +1,844 @@
{
"name": "noThinkProxy",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"express": "^5.2.1",
"node-fetch": "^3.3.2"
}
},
"node_modules/accepts": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
"dependencies": {
"mime-types": "^3.0.0",
"negotiator": "^1.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/body-parser": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
"integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",
"dependencies": {
"bytes": "^3.1.2",
"content-type": "^1.0.5",
"debug": "^4.4.3",
"http-errors": "^2.0.0",
"iconv-lite": "^0.7.0",
"on-finished": "^2.4.1",
"qs": "^6.14.1",
"raw-body": "^3.0.1",
"type-is": "^2.0.1"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/call-bound": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"get-intrinsic": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/content-disposition": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
"integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/content-type": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cookie-signature": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
"engines": {
"node": ">=6.6.0"
}
},
"node_modules/data-uri-to-buffer": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
"engines": {
"node": ">= 12"
}
},
"node_modules/debug": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/encodeurl": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
},
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/express": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
"dependencies": {
"accepts": "^2.0.0",
"body-parser": "^2.2.1",
"content-disposition": "^1.0.0",
"content-type": "^1.0.5",
"cookie": "^0.7.1",
"cookie-signature": "^1.2.1",
"debug": "^4.4.0",
"depd": "^2.0.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"finalhandler": "^2.1.0",
"fresh": "^2.0.0",
"http-errors": "^2.0.0",
"merge-descriptors": "^2.0.0",
"mime-types": "^3.0.0",
"on-finished": "^2.4.1",
"once": "^1.4.0",
"parseurl": "^1.3.3",
"proxy-addr": "^2.0.7",
"qs": "^6.14.0",
"range-parser": "^1.2.1",
"router": "^2.2.0",
"send": "^1.1.0",
"serve-static": "^2.2.0",
"statuses": "^2.0.1",
"type-is": "^2.0.1",
"vary": "^1.1.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/fetch-blob": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "paypal",
"url": "https://paypal.me/jimmywarting"
}
],
"dependencies": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
},
"engines": {
"node": "^12.20 || >= 14.13"
}
},
"node_modules/finalhandler": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
"integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
"dependencies": {
"debug": "^4.4.0",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"on-finished": "^2.4.1",
"parseurl": "^1.3.3",
"statuses": "^2.0.1"
},
"engines": {
"node": ">= 18.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"dependencies": {
"fetch-blob": "^3.1.2"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/fresh": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz",
"integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
"dependencies": {
"depd": "~2.0.0",
"inherits": "~2.0.4",
"setprototypeof": "~1.2.0",
"statuses": "~2.0.2",
"toidentifier": "~1.0.1"
},
"engines": {
"node": ">= 0.8"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/iconv-lite": {
"version": "0.7.2",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"engines": {
"node": ">= 0.10"
}
},
"node_modules/is-promise": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/media-typer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/merge-descriptors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mime-db": {
"version": "1.54.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
"dependencies": {
"mime-db": "^1.54.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/negotiator": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"deprecated": "Use your platform's native DOMException instead",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "github",
"url": "https://paypal.me/jimmywarting"
}
],
"engines": {
"node": ">=10.5.0"
}
},
"node_modules/node-fetch": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"node_modules/object-inspect": {
"version": "1.13.4",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/path-to-regexp": {
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
"integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/qs": {
"version": "6.15.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.1.tgz",
"integrity": "sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg==",
"dependencies": {
"side-channel": "^1.1.0"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/raw-body": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
"dependencies": {
"bytes": "~3.1.2",
"http-errors": "~2.0.1",
"iconv-lite": "~0.7.0",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/router": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
"dependencies": {
"debug": "^4.4.0",
"depd": "^2.0.0",
"is-promise": "^4.0.0",
"parseurl": "^1.3.3",
"path-to-regexp": "^8.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"node_modules/send": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
"dependencies": {
"debug": "^4.4.3",
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"etag": "^1.8.1",
"fresh": "^2.0.0",
"http-errors": "^2.0.1",
"mime-types": "^3.0.2",
"ms": "^2.1.3",
"on-finished": "^2.4.1",
"range-parser": "^1.2.1",
"statuses": "^2.0.2"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/serve-static": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
"integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
"dependencies": {
"encodeurl": "^2.0.0",
"escape-html": "^1.0.3",
"parseurl": "^1.3.3",
"send": "^1.2.0"
},
"engines": {
"node": ">= 18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/side-channel": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
"integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.3",
"side-channel-list": "^1.0.0",
"side-channel-map": "^1.0.1",
"side-channel-weakmap": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-list": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
"dependencies": {
"es-errors": "^1.3.0",
"object-inspect": "^1.13.4"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-map": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/side-channel-weakmap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
"dependencies": {
"call-bound": "^1.0.2",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.5",
"object-inspect": "^1.13.3",
"side-channel-map": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/type-is": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
"integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
"dependencies": {
"content-type": "^1.0.5",
"media-typer": "^1.1.0",
"mime-types": "^3.0.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/web-streams-polyfill": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
"engines": {
"node": ">= 8"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
}
}

6
package.json Normal file
View File

@@ -0,0 +1,6 @@
{
"dependencies": {
"express": "^5.2.1",
"node-fetch": "^3.3.2"
}
}