统一的大型模型代理网关,提供负载均衡、故障转移、电流限制、预算管理、内容审计、缓存和 MCP 网关功能
Every LLM provider has a different API format, auth mechanism, and feature set. Adapting your code for each one is tedious, error-prone, and locks you in.
CrossLink is a universal adapter between your application and any LLM provider:
x-crosslink-fallback-* headers, and a
routing-stats API shows configured-vs-actual traffic distribution so you can see driftWhat makes CrossLink different — each backed by code, not marketing.
RegisterEngine. Actions: block / log / mask. Per-model config, fail-open or
fail-closed. → Architecturex-crosslink-fallback-model / x-crosslink-fallback-count
headers on every response, plus a routing-distribution API showing configured-vs-actual
weight, deviation, error rate, and latency per provider./v1/chat/completions (OpenAI) and /v1/messages (Anthropic) with
automatic bidirectional translation, streaming includedPOST /v1/videos with status polling and content download,
routed through the same fallback chain as chat/admin/api/templates;
key holders discover them via GET /v1/templates (metadata + ready-to-use curl examples)RegisterEngine registry;
block / log / mask actions, admin CRUD, per-model config/openapi.json served out of the box for Postman import and
SDK codegen/demo try page with no upstream spendSee Architecture for the request flow, the streaming translator state machine, the fallback engine's timeout budgeting, and the 5-phase graceful shutdown.
The admin dashboard: request volume, cost, token usage, latency, error rate, and model distribution at a glance.
MCP server management: registry with transport types (HTTP/SSE/stdio), health status, and per-server configuration.
Provider & model configuration: weight, priority, pricing, and routing strategy per model.
Frontend (CrossLink-UI-Standard) and backend are built together. One command starts everything:
git clone https://github.com/HotRiceNoodles/CrossLink.git
cd CrossLink
docker compose -f deployments/docker-compose.dev.yaml up --buildFrontend dashboard and API gateway are available at http://localhost (port 80).
China network? Use
docker compose -f deployments/docker-compose.cn.yaml up --buildwith Go and npm mirrors pre-configured.
git clone https://github.com/HotRiceNoodles/CrossLink.git
cd CrossLink
cp configs/config.example.yaml configs/config.yaml
# Edit config.yaml with your database and Redis settings
make build
./bin/crosslinkCreate an API key via the admin dashboard (http://localhost:8080), then try it in 30 seconds:
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer cl-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'No provider key yet? Enable zero-cost demo mode (
demo.enabled: trueinconfig.yaml) — a mock provider plus an embedded demo key power a public/demotry page, so you can exercise the gateway without any upstream account.
OpenAI SDK (Python)
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1",
api_key="cl-your-api-key"
)
response = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Anthropic SDK (Python)
import anthropic
client = anthropic.Anthropic(
base_url="http://localhost:8080",
api_key="cl-your-api-key"
)
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}]
)
print(message.content[0].text)All configuration lives in configs/config.yaml. Every value can be overridden with
environment variables using the CL_ prefix (e.g., CL_DATABASE_HOST, CL_REDIS_PORT).
server:
port: 8080
read_timeout: 30s
write_timeout: 120s
database:
host: localhost
port: 5432
user: crosslink
password: crosslink
dbname: crosslink
sslmode: disable
redis:
host: localhost
port: 6379
gateway:
auth_key: "cl-change-me"
admin:
username: admin
password: changeme
jwt_secret: "change-me-to-a-random-secret"
cache:
enabled: true
default_ttl: 5m
mcp:
enabled: true
health_check_interval: 30s
crypto:
mode: standard # standard (SHA-256/RSA/AES) or gm (SM3/SM2/SM4)Providers are seeded from configs/providers.yaml on first run:
providers:
- name: deepseek
adapter_type: openai_compatible
base_url: https://api.deepseek.com/v1
api_key: ${DEEPSEEK_API_KEY}
models:
- name: deepseek-chat
provider_model: deepseek-chat| Method | Path | Description |
|---|---|---|
POST |
/v1/chat/completions |
OpenAI-compatible chat (stream & non-stream) |
POST |
/v1/messages |
Anthropic-compatible messages (stream & non-stream) |
GET |
/v1/models |
List available models |
POST |
/v1/videos |
Video generation (poll via GET /v1/videos/:id, fetch via /:id/content) |
GET |
/v1/usage |
Self-service quota & usage for key holders |
GET |
/v1/templates |
Prompt-template catalog (metadata + curl examples) |
GET |
/openapi.json |
Bundled OpenAPI spec — import into Postman or generate an SDK |
| Method | Path | Description |
|---|---|---|
POST |
/mcp/:server |
MCP JSON-RPC forwarding |
GET |
/mcp/:server |
MCP SSE transport |
| Method | Path | Description |
|---|---|---|
POST |
/admin/api/auth/login |
Login |
CRUD |
/admin/api/providers |
Provider management (test via POST /:id/test) |
CRUD |
/admin/api/models |
Model mapping management |
CRUD |
/admin/api/keys |
API key management (regenerate via POST /:id/regenerate) |
GET |
/admin/api/usage |
Usage logs with multi-dimensional filtering |
GET |
/admin/api/usage/stats |
Usage stats (incl. image metrics) + |
暂无开放 Issues,或尚未同步最近议题。