Lightweight LLM proxy written in Go
Files
README.md

feather-ai-proxy 🪶 #

Minimal, light-/ feather-weight self-hosted OpenAI-compatible proxy. One container, one URL, many providers.

Set a provider's env var to activate it. The proxy fetches that provider's model list, caches it, and serves the union on GET /v1/models as provider/model ids. POST /v1/chat/completions is a pure passthrough: the proxy rewrites model, swaps auth, and streams the upstream response. Decision models (Jev on OpenRouter) use the same rewrite on POST /v1/decisions and POST /v1/systemone.

Design: RFC 0001 and the rest of docs/rfc/. Overlay snippets: docs/examples/.

Run #

export OPENAI_API_KEY=sk-...
export GROQ_API_KEY=gsk-...
export MINIMAX_API_KEY=sk-cp-...
export OLLAMA_ENABLED=true
export PROXY_API_KEYS=sk-local-one,sk-local-two   # optional; unset = open

go run ./cmd/llm-proxy

Point Ollama at another host by overlaying base_url (docs/examples/ollama-on-lan.yaml), not by putting a URL in the env var.

Or:

just container          # macOS, Apple container CLI
# just docker           # Linux / CI
docker compose up --build

Point any OpenAI-compatible client at http://localhost:8080/v1 with one of the PROXY_API_KEYS.

curl http://localhost:8080/v1/models \
  -H "Authorization: Bearer sk-local-one"

curl http://localhost:8080/v1/chat/completions \
  -H "Authorization: Bearer sk-local-one" \
  -H "Content-Type: application/json" \
  -d '{"model":"groq/llama-3.3-70b-versatile","messages":[{"role":"user","content":"hi"}]}'

curl http://localhost:8080/v1/decisions \
  -H "Authorization: Bearer sk-local-one" \
  -H "Content-Type: application/json" \
  -d '{"model":"openrouter/typesafe/jev-1.13","state":"payment failed","questions":{"urgent":{"type":"noul","instructions":"Is this urgent?"}}}'

Config #

Three layers, applied in order: baked-in registry (internal/config/providers.yaml), optional overlay at CONFIG_PATH (default /config/config.yaml), then env vars. Env vars are the only switch. YAML only describes what a switch does.

  • Bearer providers: set the API key (OPENAI_API_KEY, MINIMAX_API_KEY, …).
  • Keyless local servers: set the flag (OLLAMA_ENABLED=true). Change the URL in the overlay.

Env #

  • PROXY_API_KEYS — comma-separated caller keys. Unset = open, with a startup warning.
  • CONFIG_PATH — overlay path, default /config/config.yaml. Missing file is fine.
  • MODEL_REFRESH_INTERVAL — Go duration, default 1h. 0 disables background refresh.
  • LISTEN_ADDR — default :8080.
  • UPSTREAM_TIMEOUT — default 10m.
  • MAX_BODY_BYTES — maximum request body size in bytes, default 10485760 (10 MiB).
  • LOG_LEVEL — debug | info | warn | error.
  • LOG_FORMAT — json | text.

Provider env vars are whatever the registry lists in env.

Endpoints #

  • GET /v1/models — optional context_length / max_tokens when upstream or overlay provides them, output_modalities when upstream reports it, and type: "classifier" when those modalities include decisions, otherwise "chat"
  • POST /v1/chat/completions (streaming and non-streaming)
  • POST /v1/responses (streaming and non-streaming; passthrough alongside chat)
  • POST /v1/decisions — structured decisions (OpenRouter forwards to /api/alpha/decisions)
  • POST /v1/systemone — same request shape, for a TypeSafe SDK pointed at this proxy
  • GET /healthz (unauthenticated; always 200 if the process is up)

Jev (openrouter/typesafe/jev-1.13, or openrouter/jev-1.13 which OpenRouter maps onto the typesafe/ namespace) is listed because the proxy also fetches OpenRouter's ?output_modalities=decisions listing (RFC 0005). Chat completions do not serve it; use /v1/decisions or /v1/systemone.

Develop #

just test
just build
just container    # Apple container CLI

CI is a Tangled Spindle. .tangled/workflows/test.yml runs just lint and just build on every push and pull request. Assign a spindle in the repo settings so the pipeline actually fires.

Disclaimer #

This project was built with AI assistance.