byrgi
Health Gecti
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 23 GitHub stars
Code Gecti
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Self-hosted AI infrastructure: deploy open models, an OpenAI-compatible gateway, agents and MCP tools on servers you own.
Byrgi
Self-hosted AI infrastructure on servers you own. Deploy open models with vLLM, put an OpenAI-compatible gateway with
per-project API keys in front of them, and run agents with an allowlisted set of MCP tools, from one dashboard, CLI or
REST API. Think "Coolify + Vercel AI Gateway, for AI infra".
- Servers and deploys: register servers (nodes dial out, no inbound SSH), deploy Docker apps and Hugging Face,
ModelScope, S3 or local models with vLLM (GPU or CPU), with blue/green releases and typed failures. - Gateway: LiteLLM with per-project API keys, rate limits, budgets, usage tracking and model management
(license gates, checksums, model cache cleanup). Hosted providers (OpenAI, Anthropic, Gemini, ...) sit behind the same keys. - Agents and tools: Docker Agent (cagent) agents and the Docker MCP Gateway, with a catalog UI, a per-project tool
allowlist and every tool call in the audit log. - Dashboard: accounts and roles, 2FA, one-click model templates, a playground, and an MCP server for your AI tools.
Documentation: byrgi.vercel.app/docs · Quick start: Run the control plane
Architecture
Dashboard (Next.js, web/) ──▶ Go API (cmd/server) ──▶ PostgreSQL (state, jobs, encrypted secrets, keys, usage, audit)
│ ▲ agent endpoint :8443 (mTLS gRPC stream + join bootstrap)
admin API: models,│ │ nodes dial OUT; no inbound SSH
keys; spend logs ▼ │
clients ──▶ LiteLLM :4000 (/v1) ──HTTPS──▶ Traefik on the node ──▶ vLLM container (--api-key)
byrgi-agent (cmd/agent) on each node ──▶ Docker: vLLM / app containers, Traefik
| Path | What it is |
|---|---|
proto/agent/v1/agent.proto |
Control plane ↔ agent contract (scripts/gen-proto.sh regenerates gen/) |
internal/api |
REST API: projects, secrets, servers/join tokens, services, releases, deployments, audit |
internal/controlplane |
Agent stream: pushes jobs, records status, resolves secrets at send time |
internal/jobs |
Postgres job queue (FOR UPDATE SKIP LOCKED + LISTEN/NOTIFY) |
internal/pki |
Internal CA; agents pin it by SHA-256 and get client certs at join |
internal/secrets |
AES-256-GCM with the master key, bound to environment + name |
internal/gateway |
LiteLLM client, reconciler (models + key model lists + service deletes), spend-log usage sync |
internal/hf |
Hugging Face metadata, license gate, VRAM estimate, resumable checksum-verified downloads |
internal/agent/drivers |
Replaceable drivers: app, model.vllm, mcp.gateway, agent.cagent |
internal/mcp |
Docker MCP catalog client (cached), allowlist checks against catalog entries |
deploy/ |
compose.yaml for the control plane, install.sh node installer |
Behaviour worth knowing:
- Placement is manual (you pick the server). The agent assigns free GPUs and labels containers with them.
- Blue/green: the previous release is stopped only after the new one passes readiness (apps: port open and stable;
models: a real/v1/completionscall). On failure the new container is removed and the old one keeps serving.
If a model's GPUs are all in use by its previous release, it is replaced in place. - Typed failures:
image_pull,download,checksum,gpu_oom,no_gpu,disk_full,readiness_timeout,container_exited. - Isolation: one Docker network per project/environment; Traefik is attached to each, projects never share one.
- Model gates: non-permissive or gated licenses need
license_ack; VRAM/disk fit is checked against the chosen server (forceskips the fit check only). - Delete is two-step: the service is marked, every deployment gets a stop job, and the service (plus a model's key
secret) is removed once the node confirms. Deleting a model that an app lists inmodelsis refused. - Model cache: agents report cached revisions (size, verified, in use) with each heartbeat. Purging is refused while a
container mounts the revision or any deploy is in progress on that node. - Model sources (
vllm.source):huggingface(default): pinned to a commit, every file checksum-verified.hf_endpointpoints one model at an
HF-compatible mirror (e.g.https://hf-mirror.com); the agent's--hf-endpointsets a node-wide default.modelscope: same pinning and SHA-256 checks against modelscope.cn (default revisionmaster). Its anonymous API
is rate limited; a ModelScope token (hf_token_secret) helps.local:local_pathis a folder in Hugging Face layout under the agent's--local-models-dir
(default<data-dir>/local-models), mounted read-only. Paths with.., absolute paths and symlinks leading
outside that directory are refused. License, VRAM and disk are not checked for local or S3 weights.s3:s3.url(s3://bucket/prefix), optionalendpoint(MinIO and other S3-compatible stores use path-style
URLs),region, and project secrets for the keys (none = public bucket). The node mirrors the prefix into its model
cache (listed ass3.<bucket>/<prefix>), resumes partial files, checks sizes and single-part MD5 ETags, and
downloads again only when the listing (keys, sizes, ETags) changes.
- Hosted models (
external:provider,model,key_secret, optionalapi_base): OpenAI, Anthropic, Gemini,
Mistral, Groq, DeepSeek, xAI, Together, Fireworks, OpenRouter or any OpenAI-compatible API. Nothing runs on a node and
no server is chosen; the reconciler registers them in LiteLLM with the provider key from the project secret, so
project API keys, limits, budgets and usage apply as for self-hosted models. The key secret belongs to you and is
kept when the model is deleted. Apps and agents cannot wire a hosted model in directly yet; they call it through the
gateway with a project API key.
Gateway
LiteLLM runs next to the API (deploy/compose.yaml) and is the only public way to call models:
- Registration: a reconciler (every 30 s, and right after deployments change state) registers each running model
service as<project>/<service>(<project>/<env>/<service>outside production) and removes anything Byrgi
registered that no longer runs. LiteLLM calls the model athttps://<model domain>/v1with the model's vLLM key, so a
model needs a public domain with a valid certificate (Traefik + Let's Encrypt) to be in the gateway. - Local models (no domain): a node on the same Docker host as the control plane can run its agent with
--gateway-container byrgi-litellm-1(orBYRGI_GATEWAY_CONTAINER). The agent attaches that container to every
project network (re-checked with each heartbeat, since recreating the container drops its networks) and reports it;
the reconciler then registers models without a domain athttp://<container>:8000/v1. This joins the gateway to
every project's network, like Traefik, so use it only on a single-machine setup. - Timeouts: every model (self-hosted or hosted) is registered with a request timeout,
request_timeoutin its spec
(--request-timeoutin the CLI), 600 s by default, at most 3600 s. A model that accepts a request and then stalls
returns a timeout error to the client instead of holding the connection for LiteLLM's default of 6000 s. Changing the
value re-registers the model. Node health checks only see crashed or missing containers, so the timeout is what
catches a vLLM process that is up but no longer answering. - API keys belong to a project and may call only that project's models; the reconciler updates every key's model list
as models come and go. Keys always include the placeholder modelbyrgi-no-models, because LiteLLM treats an empty
list as "all models". Raw keys are shown once; Byrgi and LiteLLM store the same SHA-256 hash. - Limits per key: requests/min, tokens/min, parallel requests, budget (+ reset period), expiry. Enforced by LiteLLM
(429 when exceeded). Budgets only bite for models with a configured cost; self-hosted models cost 0 by default. - Usage: the server copies LiteLLM's
LiteLLM_SpendLogs(separatelitellmdatabase) intousage_eventsevery
minute, deduplicated by request id. Successful requests and rejected/failed ones (auth, rate limit, upstream) are
counted separately. Views: by day, model and key (/usage,byrgi usage).
Agents and tools
- MCP gateway (
mcp.gateway,docker/mcp-gateway:v0.44.3): one per project environment. Its spec is the
environment's tool allowlist: catalog servers, optionally limited to some tools, with their secrets mapped to project
secrets and their settings. The gateway runs each allowed server as its own short-lived container and serves only the
allowed tools onhttp://<name>:8811/mcpinside the project network, behind a generated bearer token
(MCP_<NAME>_TOKEN). Secrets and settings are copied into the container before it starts (never written to the
node's disk) and each secret reaches only the server that declares it. Changing the allowlist deploys a new release
(blue/green, like every other service). - The gateway needs the node's Docker socket, which makes it root-equivalent on that node. Its image and arguments
are fixed by Byrgi; users only pick catalog servers. Image signatures are verified (--verify-signatures). - Catalog: Byrgi reads
https://desktop.docker.com/mcp/catalog/v3/catalog.json(the catalog the pinned gateway
uses), caches it for 6 h and validates every allowlist entry against it (unknown tools, missing secrets or required
settings are rejected). Only container servers (type: server, ~235 of ~315) are supported; remote and OAuth servers
are not yet.BYRGI_MCP_CATALOG_URLoverrides the URL,offdisables the catalog. - Agents (
agent.cagent,docker/docker-agent:1.161.0, formerly cagent): instruction + a model service + optionally
the environment's MCP gateway (and an optional narrower tool list). Byrgi renders the agent config, so model and gateway
credentials come from project secrets through env vars. The agent serves Docker Agent's HTTP API on:8080(/api,
optionally on a public domain) behind a generated token (AGENT_<NAME>_TOKEN); the agent id is the service name.
Sessions live in a per-agent volume.tool_approval: auto(default) lets allowlisted tools run without asking;client
makes API clients approve each call. - Audit: the node agent follows each gateway's call log and records every tool call (
mcp.tool_call: project,
server, tool, duration, whether a result came back) in the audit log. Calls made while the node agent is down are not
recovered. Allowlist changes are audited too (mcp.server.allow|update|remove). - Deleting a model or gateway that an agent uses is refused; models and gateways must run on the same server as their
agents (project networks are per node).
byrgi deploy mcp --project demo --server gpu-1 # prints the gateway token once
byrgi mcp catalog github # browse; byrgi mcp show github-official
byrgi secrets demo set GITHUB_TOKEN - # paste a PAT, Ctrl-D
byrgi mcp demo allow github-official --tool list_issues --tool issue_read \
--secret github.personal_access_token=GITHUB_TOKEN
byrgi deploy agent --project demo --server gpu-1 --name triage --model llm --mcp mcp \
--instruction "You triage issues in acme/api." --domain triage.example.com # prints the agent token once
SESSION=$(curl -s -X POST https://triage.example.com/api/sessions -H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" -d '{}' | jq -r .id)
curl -N -X POST https://triage.example.com/api/sessions/$SESSION/agent/triage -H "Authorization: Bearer $AGENT_TOKEN" \
-H "Content-Type: application/json" -d '{"messages":[{"role":"user","content":"Summarize open bugs"}]}'
byrgi tool-calls --project demo
Run the control plane
git clone https://github.com/mhmdsalahsebai/byrgi.git && cd byrgi
scripts/start.sh # first run: creates deploy/.env with random credentials, builds, starts, waits until healthy
scripts/start.sh status # containers
scripts/start.sh logs # follow logs
scripts/start.sh down # stop (data stays in Docker volumes)
On a server, tell it the address people will use (the dashboard only accepts sign-in from that address):
scripts/start.sh --host 203.0.113.5 # plain HTTP: http://203.0.113.5:3000, gateway :4000
scripts/start.sh --domain cp.example.com # optional HTTPS: Caddy + Let's Encrypt on one domain
--domain is optional. It adds a Caddy container that serves the dashboard at https://<domain>, the gateway at/v1 and the API at /api/v1 (LiteLLM's admin routes stay internal). It needs the domain's DNS pointing at the
server and ports 80/443 open, and can't share a machine with a node's Traefik (both use 80/443). Already have a reverse
proxy? Skip --domain, point yours at ports 3000/4000/8080 and set BYRGI_WEB_PUBLIC_URL andBYRGI_GATEWAY_PUBLIC_URL to its addresses. With HTTPS in front you can set BYRGI_BIND_ADDRESS=127.0.0.1 to keep the
plain-HTTP ports private. Open port 8443 for remote nodes either way.
First admin: on its first start the dashboard creates BYRGI_ADMIN_EMAIL (default [email protected]) withBYRGI_DASHBOARD_PASSWORD from deploy/.env (generated, 12+ characters). It only does this while there are no users,
so editing those values later changes nothing. Change the password and turn on two-step verification on the Account page.
scripts/setup-env.sh (run by start.sh, same --host / --domain flags) writes deploy/.env, which git ignores
(mode 600). It fills only empty or change-me secrets, so re-running it never changes existing credentials. You can
also fill deploy/.env by hand from deploy/.env.example; Compose refuses to start while a required secret is empty:
| Key | Used for |
|---|---|
BYRGI_DASHBOARD_PASSWORD |
password of the first dashboard admin, BYRGI_ADMIN_EMAIL (default [email protected]), created on first start |
BETTER_AUTH_SECRET |
signs dashboard sessions and OAuth tokens for MCP clients |
BYRGI_ADMIN_TOKEN |
CLI and REST API (Authorization: Bearer) |
BYRGI_MASTER_KEY, LITELLM_SALT_KEY |
encrypt stored secrets; never change them after the first start |
POSTGRES_PASSWORD, LITELLM_MASTER_KEY |
internal |
BYRGI_WEB_PUBLIC_URL, BYRGI_GATEWAY_PUBLIC_URL, BYRGI_AGENT_PUBLIC_URL |
addresses users, clients and nodes use (set by --host / --domain) |
BYRGI_DOMAIN, COMPOSE_PROFILES=proxy |
optional HTTPS proxy (set by --domain) |
BYRGI_BIND_ADDRESS |
interface for ports 3000/4000/8080 (default 0.0.0.0) |
Back up deploy/.env together with the Docker volumes (byrgi_pgdata, byrgi_serverdata holds the node CA): the data
can't be decrypted without the keys in .env.
Read a value with grep ^BYRGI_DASHBOARD_PASSWORD= deploy/.env. To start over with new credentials, delete all data
first (docker compose -f deploy/compose.yaml --env-file deploy/.env down -v), then rm deploy/.env: Postgres keeps
the password it was created with.
API on :8080, dashboard on :3000, gateway on :4000, agent endpoint on :8443 (BYRGI_AGENT_PUBLIC_URL must be reachable
from nodes; set it and BYRGI_AGENT_HOSTS in deploy/.env before adding remote nodes). On a fresh volume Postgres
creates the litellm database from deploy/initdb/; on older installs the server creates it at startup.
Add a node and deploy
scripts/go.sh go build -o bin/ ./cmd/... # builds bin/byrgi (no local Go needed)
bin/byrgi login --api http://localhost:8080 --token "$(grep ^BYRGI_ADMIN_TOKEN= deploy/.env | cut -d= -f2-)"
byrgi projects create demo
byrgi servers add gpu-1 # prints the install command to run as root on the node
byrgi deploy model --project demo --server gpu-1 --name llm --repo Qwen/Qwen2.5-7B-Instruct --domain llm.example.com
byrgi deploy app --project demo --server gpu-1 --name chat --image ghcr.io/open-webui/open-webui:main \
--port 8080 --domain chat.example.com \
--env OPENAI_API_BASE_URL=http://llm:8000/v1 --secret OPENAI_API_KEY=MODEL_LLM_API_KEY
byrgi status <service-id>
byrgi keys demo create backend --rpm 60 --tpm 100000 # prints the key once
curl http://localhost:4000/v1/chat/completions -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"model":"demo/llm","messages":[{"role":"user","content":"Hello"}]}'
byrgi usage --project demo
byrgi models # license, weights, gateway state, requests
byrgi cache gpu-1 # cached weights; byrgi cache gpu-1 purge OWNER/MODEL COMMIT
byrgi delete <service-id>
No GPU? Add --cpu (or tick "Run on CPU" in the dashboard) to run a model on the server's CPU withvllm/vllm-openai-cpu. It is slow and uses host RAM (1 GiB KV cache by default), so it is meant for tiny models and
demos, for example --repo HuggingFaceTB/SmolLM2-135M-Instruct --cpu --max-model-len 2048 (about 270 MB of weights,
~3 GB RAM while running). CPU models start with --enforce-eager (skips a torch.compile warmup that can take 10+ minutes);
pass --vllm-arg=-O1 to compile anyway. A release runs next to the previous one until it is ready, so a machine with
little RAM may need the old one stopped first.
Model services are reachable inside their project network as http://<name>:8000/v1; the API key is stored as the
secret MODEL_<NAME>_API_KEY. Apps that list --model llm also get LLM_BASE_URL, LLM_API_KEY and LLM_MODEL injected.
Dashboard
Accounts and roles (better-auth). The first start creates an admin fromBYRGI_ADMIN_EMAIL / BYRGI_DASHBOARD_PASSWORD; sign-up is closed and admins add people on Users. Roles
(web/lib/permissions.ts): admin (everything, including users, bans, impersonation), operator (deploy and
operate services, keys, secrets, tools, playground), viewer (read-only). Every server action and API route checks
the role on the server; hidden buttons are only cosmetic. Accounts live in the auth schema of the Byrgi database,
migrated at startup.
Account page: name, password (12+ characters), TOTP two-step authentication with backup codes, personal API keys,
signed-in devices and connected MCP apps. Sign-in, 2FA and password changes are rate limited.
Playground (/playground): chat with any running model through the gateway, with time to first token and
tokens/s. The same endpoint works from scripts with a personal API key:
curl -N http://localhost:3000/api/chat -H "x-api-key: byrgi_..." -H "Content-Type: application/json" \
-d '{"model":"my-project/llm","messages":[{"role":"user","content":"Hello"}]}'
MCP: the dashboard is an MCP server at <BYRGI_WEB_PUBLIC_URL>/api/mcp with OAuth 2.1 sign-in (dynamic client
registration, consent screen). Tools: list_projects, list_services, list_models, list_servers (scopebyrgi:read) and chat (scope byrgi:chat, needs a role that may use the playground). For exampleclaude mcp add --transport http byrgi http://localhost:3000/api/mcp.
Design system: Tailwind CSS v4, shared with the public site (site/): white canvas, near-black pill buttons, one
violet accent, Outfit for display type at regular weight, Inter for UI. Tokens are in web/app/globals.css (Tailwind's
default palette, radii, shadows and fonts are removed), primitives in web/components/ui (Scenery/AuthFrame hold the
landscape artwork for sign-in pages). npm run lint:design (also run before every build) rejects color literals,
arbitrary values, inline styles, raw form/table elements outside the primitives, non-token colors, and radii, shadows,
font families or weights outside the scales (nothing is bold).
Development
Go is not required locally: scripts/go.sh runs the toolchain in golang:1.26.
scripts/go.sh go test ./...
scripts/go.sh go build -o bin/ ./cmd/...
cd web && npm install && npm run check && npm run build
Contributing
Issues and pull requests are welcome; see CONTRIBUTING.md. Report security problems privately, as
described in SECURITY.md.
License
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi