- POST /v1/messages endpoint with full quota enforcement and auth - Accepts x-api-key and anthropic-auth-token headers (for Claude Code) - Transforms Anthropic request/response format ↔ Ollama /api/chat - Streaming support via Anthropic SSE format - Tool use support (request and response transformation) - ANTHROPIC_DEFAULT_MODEL env var for model selection without admin UI - BACKEND_API_KEY env var for forwarding auth to upstream proxies - Fix SQLite path always resolved relative to database.py location - start.sh and start_claude.sh load .env relative to script location
34 lines
839 B
Bash
Executable File
34 lines
839 B
Bash
Executable File
#!/bin/bash
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
# .env laden
|
|
if [ -f "$SCRIPT_DIR/.env" ]; then
|
|
set -a
|
|
source "$SCRIPT_DIR/.env"
|
|
set +a
|
|
fi
|
|
|
|
# API-Key: erstes Argument hat Vorrang, sonst Umgebungsvariable PROXY_API_KEY
|
|
API_KEY="${1:-$PROXY_API_KEY}"
|
|
|
|
if [ -z "$API_KEY" ]; then
|
|
echo "Fehler: Kein API-Key angegeben."
|
|
echo "Verwendung: ./start_claude.sh sk-dein-key"
|
|
echo " oder: PROXY_API_KEY=sk-dein-key ./start_claude.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# 0.0.0.0 ist eine Bind-Adresse, kein gültiger Client-Host
|
|
PROXY_HOST="${PROXY_HOST:-0.0.0.0}"
|
|
PROXY_PORT="${PROXY_PORT:-8000}"
|
|
if [ "$PROXY_HOST" = "0.0.0.0" ]; then
|
|
PROXY_HOST="localhost"
|
|
fi
|
|
|
|
export ANTHROPIC_BASE_URL="http://${PROXY_HOST}:${PROXY_PORT}"
|
|
export ANTHROPIC_AUTH_TOKEN="$API_KEY"
|
|
|
|
echo "Verbinde mit Proxy: $ANTHROPIC_BASE_URL"
|
|
exec claude
|