A cross-protocol LLM gateway proxy.
InsightLayer sits between your applications and LLM providers. It translates requests and responses between the OpenAI and Anthropic API formats, so a client built for one protocol can talk to a backend that speaks the other. It handles both streaming and non-streaming requests, rewrites authentication headers across protocols, and gives you a hook system to inspect or modify traffic as it flows through.
The whole thing is a single Go binary with one dependency (a YAML parser). You write a config file, start the server, and point your clients at it.
Build and install:
go install ./cmd/insightlayerOr with make:
make buildCreate a config file. This minimal example proxies OpenAI-format chat requests to a local LM Studio server:
server:
listen: ":9090"
routing:
routes:
- name: chat
priority: 100
inbound_protocol: openai
path_prefix: /v1/chat/completions
endpoint_kinds: [chat]
backend: local
backends:
- name: local
protocol: openai
base_url: http://127.0.0.1:8080
auth:
mode: passthroughStart the server:
insightlayer -config config.yamlSend a request:
curl http://localhost:9090/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5-9b-unsloth-mlx",
"messages": [{"role": "user", "content": "Hello!"}]
}'That request goes through InsightLayer to LM Studio and comes back as a
standard OpenAI chat completion response. Streaming works the same way -- just
add "stream": true to the request body.
The core idea is protocol translation. Every incoming request is decoded into a protocol-neutral representation, passed through any configured hooks, re-encoded into the backend's wire format, and sent upstream. The response takes the reverse path. This means you can point an OpenAI client at an Anthropic backend, or an Anthropic client at an OpenAI-compatible server, and everything just works.
Routes are matched by path prefix and priority, so you can set up different backends for different endpoints or namespaces. Authentication credentials are translated automatically between protocols (Bearer tokens and X-Api-Key headers).
Hooks let you log requests, redact sensitive text, or modify headers at each stage of the pipeline. They run in the order you define them and operate on the normalized representation, not the raw wire format.
Configuration is YAML-based. Environment variables can be referenced with
${VAR} syntax and are expanded at startup. See config.example.yaml for a
verbose example that demonstrates every feature, or read the
configuration guide for a walkthrough of all
options.
- Getting Started -- installation, first config, first request
- Configuration -- server settings, environment variables, health check, logging
- Routing -- route matching, priorities, namespaces, catch-all routes
- Backends -- upstream services, protocols, default headers
- Authentication -- inject, passthrough, prefer_client, cross-protocol credential translation
- Cross-Protocol Translation -- the normalize-then-encode pipeline, OpenAI-to-Anthropic and back
- Streaming -- SSE, cross-protocol streaming, error handling
- Hooks -- logging, text redaction, header modification
- Examples -- complete working configs you can copy