qwen-kolibri-rust-gateway
v0.1.0
Published
Kolibri Rust OpenAI-compatible gateway launcher for Qwen Code CLI
Readme
qwen-kolibri-rust-gateway
Fast local OpenAI-compatible Rust gateway for Qwen Code CLI, OpenAI SDK clients, curl, IDE agents, and future Kolibri API deployment.
Architecture
OpenAI SDK / Qwen Code CLI / curl
→ http://127.0.0.1:8787/v1
→ Kolibri Rust Gateway
→ upstream OpenAI-compatible providerFirst upstream target:
https://kolibriai.ru/v1Future upstream target:
https://api.kolibriai.ru/v1Clients only change baseURL.
What this gateway does
- Local OpenAI-compatible
/v1/chat/completionsgateway. - Passthrough to OpenAI-compatible upstream.
- Stream passthrough for SSE.
- Tool calls passthrough.
exit_plan_modepassthrough.- Model suffix routing:
qwen3.6-plus#project-a→ upstream modelqwen3.6-plus, session keyproject-a.qwen/qwen3.6-plus#project-a→ upstream modelqwen3.6-plus, session keyproject-a.
- Optional
enable_thinkinginjection. - Local/Upstream API key separation.
- Secret masking in debug output.
qwen-localwrapper over the original Qwen Code CLI.
What it intentionally does not do
- No direct
chat.qwen.ai/api/v2browser reverse-engineering. - No custom agent loop.
- No local tool execution.
- No rewrite of Qwen CLI.
- No prompt-based fake JSON tool call generation.
Setup
cp .env.example .env
nano .envSet:
UPSTREAM_API_KEY=your_aikit_or_upstream_key
LOCAL_API_KEY=local-proxy-key-2026Build and run:
cargo check
cargo runHealth:
curl -s http://127.0.0.1:8787/health | python3 -m json.toolModels:
curl -s http://127.0.0.1:8787/v1/models \
-H "Authorization: Bearer local-proxy-key-2026" \
| python3 -m json.toolChat non-stream:
curl -s http://127.0.0.1:8787/v1/chat/completions \
-H "Authorization: Bearer local-proxy-key-2026" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3.6-plus#project-a","stream":false,"messages":[{"role":"user","content":"Ответь одним словом: работает?"}]}' \
| python3 -m json.toolChat stream:
curl -N http://127.0.0.1:8787/v1/chat/completions \
-H "Authorization: Bearer local-proxy-key-2026" \
-H "Content-Type: application/json" \
-d '{"model":"qwen3.6-plus#project-a","stream":true,"messages":[{"role":"user","content":"Напиши три слова: тест bridge работает"}]}'OpenAI SDK usage
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.KOLIBRI_API_KEY || "local-proxy-key-2026",
baseURL: process.env.KOLIBRI_BASE_URL || "http://127.0.0.1:8787/v1",
});
const completion = await client.chat.completions.create({
model: "qwen3.6-plus#my-project",
messages: [{ role: "user", content: "Ответь одним словом: работает?" }],
});
console.log(completion.choices[0].message.content);Global Installation
Install globally via npm to use qwen-kolibri from any directory:
npm install -g qwen-kolibri-rust-gatewayAfter installation, run from anywhere:
qwen-kolibri [options]Custom KOLIBRI Banner
The wrapper displays a colorful ASCII banner before launching Qwen Code:
█▀█▀█▀█ ██ ██ █▀█▀█▀█ █▀█▀ ██
██╔═══██╗██║ ██║██╔════╝████╗ ██║ │ >_ KOLIBRI Gateway │
██║ ██║██║ █╗ ██║█████╗ ██╔██╗ ██║ │ │
██║▄▄ ██║██║███╗██║██╔══╝ ██║╚██╗██║ │ API Key | qwen3.6-plus (/model to change) │
╚██████╔╝╚███╔███╔╝███████╗██║ ╚████║ │ ~/your/project │
╚══▀▀═╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═══╝ └──────────────────────────────────────────────────────────┘Colors: red (K, L, B), green (O, I), yellow (I, R) via ANSI escape codes.
Disable banner: use --no-banner flag:
qwen-kolibri --no-banner [other args]The wrapper:
- loads
.env; - starts the gateway if not already running;
- creates project-specific model suffix;
- creates isolated Qwen settings under
.qwen-kolibri/settings.json; - runs original
qwendirectly withoutscript | python3.
Custom KOLIBRI Banner
The bin/qwen-local wrapper displays a colorful KOLIBRI banner before launching Qwen Code:
█▀█▀█▀█ ██ ██ █▀█▀█▀█ █▀█▀ ██
██╔═══██╗██║ ██║██╔════╝████╗ ██║ │ >_ KOLIBRI Gateway │
██║ ██║██║ █╗ ██║█████╗ ██╔██╗ ██║ │ │
██║▄▄ ██║██║███╗██║██╔══╝ ██║╚██╗██║ │ API Key | qwen3.6-plus (/model to change) │
╚██████╔╝╚███╔███╔╝███████╗██║ ╚████║ │ ~/your/project │
╚══▀▀═╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═══╝ └──────────────────────────────────────────────────────────┘Colors: red (K, L, B), green (O, I), yellow (I, R) via ANSI escape codes.
Disable banner: use --no-banner flag:
qwen-local --no-banner [other args]Benchmark
export AIKIT_API_KEY="your_key"
./scripts/bench_aikit_vs_gateway.shOutput:
local-data/bench/<timestamp>/Deployment path
Local:
OPENAI_BASE_URL=http://127.0.0.1:8787/v1Future server:
OPENAI_BASE_URL=https://api.kolibriai.ru/v1Client code does not change.
