Skip to content
Phat1911Public

About

Self-hosted AI key governance — your team shares one AI key, everyone gets their own: per-member keys, quotas, leak detection, append-only audit. Free & open source (FSL). V2 roadmap: Solana-settled credit marketplace (gated).

Topics

Resources

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Latest commit

 

History

200 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tributary

Small streams. Pooled power.

Landing page: https://phat1911.github.io/Tributary/ — one screen, live screenshots, the two-minute quickstart.

Status: v0.1.4 — self-hostable AI token pools (gateway, org pools, dashboard). Pre-alpha software, real release: every org gets per-user keys over pooled provider capacity, with quotas, audit, and leak signals. Roadmap lives in SPEC.md §14.

Why Tributary?

What Tributary is today: a free, self-hosted V1 governance tool. One container on your own machine, no recurring cost, no hosted tier — your team's AI usage, governed by you. The V2 marketplace is a gated roadmap: it opens only behind provider/reseller agreements for credit transfer. It is not the storefront — V1 is the product.

Hosted API routers are convenient — but they hold your keys, your credits, and your usage data, and they optimize for one developer choosing among models. Tributary optimizes for teams sharing their own capacity:

  • No middleman, no markup — you pay provider prices directly; the software is free (FSL-1.1-ALv2) and runs in one container on your own machine.
  • Your keys and usage stay in the building by default — envelope-encrypted at rest, exposed to no third party. One optional exception, taken only by org choice: the purpose classifier — off by default, disclosed to members — sends prompts to the classifier provider the org configures when (and only when) the org enables it.
  • Governance out of the box — per-member keys, quotas, two-network sharing detection, and a database-enforced append-only audit log: everything a key pasted into a group chat can never give you.
  • On a router, your money only spends — if V2 opens, idle credits can optionally earn (gated roadmap — see below).

Self-hosted and a marketplace? The boundary, stated plainly: V1 is governance inside one trust domain — no blockchain, ever; your keys and usage data stay in your building. The V2 marketplace is opt-in, pool by pool, built for the same people V1 serves on both sides: teams and individuals holding surplus AI credits (students, startups, labs) supplying them, and cost-conscious builders drawing from them. Where strangers exchange value — and nowhere else — the chain carries the receipts: append-only books, escrow no single person can move, every money moment a public record.

Why the marketplace works — the economics, plainly. Credits bought at face value never enter the market; the official provider is the correct answer for those. The market lives on supply with a zero or sunk cost basis: granted credits, hackathon prizes, education allocations, expiring promos, and committed spend a team has already paid for but won't consume — for that supply, selling below face value is salvage, not a price war. And pools offer one thing no single key can: a pool of N keys serves N× the rate limits — for AI agents, speed runs out before money does.

Depositor mode (experimental). A pool created with kind:"root" accepts depositor-supplied keys and credits and settles earnings per depositor for each burn window. Root pools are strictly opt-in — org pools (the default) are unchanged — and the feature is experimental: the adversarial audit session runs this week, and findings land in the public AUDIT.md as they always do. The settlement layer it targets is live on Solana devnet: program 9pEmyxftdRUZV2iw6ZzCNgZz9QygG53i7APNaWcEHvjX — 2-of-2 multisig governed, upgrade history public on any explorer.

One line: a router is something you rent; this is a building you own.

Business model, plainly

V1 is free forever, by strategy: adoption first, zero recurring cost — the software costs us nothing per org you run. The first dollar Tributary plans to earn is an operator's settlement fee (a fixed 5–10% band) on V2 marketplace volume, paid by operators — never by members. V2's launch gate includes provider/reseller agreements for credit transfer; until that gate opens, Tributary is exactly what you see: a free, self-hosted governance tool. No dollar is planned from ToS-gray flows, and if V2 never opens, V1 stands on its own.

Quickstart

Which terminal? Run these in a POSIX shell — Linux, macOS, or WSL on Windows (enable Docker Desktop's WSL integration, check with docker ps) — and paste the block as-is. Windows PowerShell works line-by-line instead: split the first line at &&, use Copy-Item deploy\.env.example .env, drop the trailing \ continuations, and generate the key in WSL/Git Bash (openssl rand -hex 32). CMD is not supported.

No compose plugin? (docker compose up -d says unknown shorthand flag: 'd') — the plugin is missing from your Docker install. Fix: Docker Desktop → Settings → Resources → WSL Integration on, or apt install docker-compose-plugin; or skip compose entirely:

permission denied ... /var/run/docker.sock? your user isn't in the docker group. Fix: sudo usermod -aG docker $USER && newgrp docker (or restart WSL), then check docker ps runs without sudo. WSL-native Docker also needs sudo service docker start; Docker Desktop users: enable WSL Integration for this distro.

git clone https://github.com/Phat1911/Tributary.git && cd Tributary
cp deploy/.env.example .env
echo "TRIBUTARY_MASTER_KEY=$(openssl rand -hex 32)" >> .env   # REQUIRED — your vault key; keep it secret
docker compose up -d          # prefers the prebuilt image; builds from source only as fallback
docker exec -it \
  -e TRIBUTARY_DATABASE_URL=sqlite:///data/tributary.db \
  -e TRIBUTARY_ADMIN_PASSWORD="$(openssl rand -base64 18)" \
  tributary tributary create-admin --email you@example.com
# (--password '<secret>' on the command line also works — but it lands in
#  your shell history; the env var is the documented path)
# compose-free equivalent (same container, same volume, shipped image):
docker run -d --name tributary -p 8111:8080 --env-file .env \
  -v tributary-data:/data --restart unless-stopped ghcr.io/phat1911/tributary:latest

Login at http://localhost:8111 — time to first login is ~2 minutes with the prebuilt image (the first up pulls ~110 MB); ~10–15 minutes if it builds from source instead (cold Rust + dashboard compile).

Trusted-proxy note: if you front Tributary with a reverse proxy, set TRIBUTARY_TRUSTED_PROXIES to that proxy's CIDR — IP-derived controls (allowlists, sharing detection) are only sound then; without it, X-Forwarded-For is ignored and the socket address is used. Details: deploy/README.md.

Provider keys — OpenAI and Gemini: pools accept keys from any OpenAI-compatible endpoint. A Google AI Studio (Gemini) key goes in with provider Gemini and base URL https://generativelanguage.googleapis.com/v1beta/openai; member traffic is then metered, quota-checked, and leak-watched exactly like OpenAI-routed traffic. Tributary speaks (and meters) the OpenAI-compatible wire format on all pools — it is not a format converter, and the native Gemini API shape is not translated. Note the free tier of AI Studio is rate-limited: fine for demos and pilots, but expect upstream 429s under load. Details: deploy/README.md.

What it is

A tributary is a small stream that feeds a larger river — and that is the whole design: members' small, governed streams of AI usage flowing into one pooled upstream capacity. Each member gets their own API key; every request is metered, quota-checked, and IP-fingerprinted at the gateway before any upstream call. The pool's owner holds the provider keys (envelope-encrypted at rest) and decides who draws how much; odd signals — impossible travel, key sharing across countries — surface as review flags, not silent surprises.

Where to go next

deploy/README.md Detailed ops: ports, reverse proxies (the trusted-proxy setting matters), backups, Postgres, healthchecks, quota behavior, upgrades
docs/threat-model.md What is audited and how, what is not independently reviewed yet, bus factor — the honest boundaries
docs/onboarding-org-admin.md Admin first-day guide (DRAFT v1) — empty box → org → pool → member key → first request
docs/pilot-support.md "It broke" diagnostics runbook — healthz → logs → audit → review queue, with the known fixes
Pilot feedback Running a pilot? Tell us what worked, what broke, what's missing — it drives the M6 rewrite
SPEC.md Architecture, security/economic rules, milestone roadmap
SECURITY.md Private disclosure by email; finder credit
CONTRIBUTING.md Conventions (teaching comments, dual-DB rule) and dev setup
LICENSE FSL-1.1-ALv2 — each version converts to Apache-2.0 after two years

Repository layout

crates/            Rust workspace (gateway, control, ledger, crypto, common)
apps/dashboard/    Next.js + TypeScript dashboard (pnpm workspace)
deploy/            Dockerfile, entrypoint, .env.example — single-container deploy
docker-compose.yml the quickstart deployment (root; reads a gitignored .env)

Developing

Rust:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

Dashboard:

pnpm install
pnpm -C apps/dashboard build

CI (.github/workflows/ci.yml) runs all of the above, cargo-deny, and the official-SDK contract tests (OpenAI and Gemini-compat upstreams, real OpenAI-SDK clients).

License

Copyright 2026 Tran Dinh Hong Phat. Licensed under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2). Each version converts to Apache-2.0 two years after it is made available.

About

Self-hosted AI key governance — your team shares one AI key, everyone gets their own: per-member keys, quotas, leak detection, append-only audit. Free & open source (FSL). V2 roadmap: Solana-settled credit marketplace (gated).

Topics

Resources

Contributing

Security policy

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages