A local API cupboard for your laptop. Store all API keys once in the OS keychain and use them in any project through env injection or a localhost proxy. No .env files. Go, single binary, Windows and Linux.
A local API cupboard for your laptop.
Store your API keys once. Use them in every project. Keep them out of your repos.
Status: In development.
add,list,remove,run,serve, the web UI and its request log work today. The desktop icon and release binaries are still to come. Seedocs/project-plan.md.
You copy the same OpenAI, Stripe or GitHub keys into .env files in many projects. Each copy is a chance to commit a secret by mistake. When a key changes, you must update every copy.
API Cupboard keeps each key in one place: your OS keychain. Your projects get the keys only when they run.
cupboard run -- <command> starts your command with the keys as environment variables.127.0.0.1:9090/<shelf>/.... The proxy adds the key and forwards the request. Your app never sees the key.flowchart LR
subgraph Inject mode
A[You run<br/>cupboard run -- cmd] --> B[cupboard run<br/>reads cupboard.toml]
B --> C[Your app process<br/>keys as env vars]
end
UI[Web UI] -- writes --> K[(OS keychain)]
K -- key --> B
K -- key --> E
subgraph Proxy mode
D[Your app<br/>calls 127.0.0.1:9090] --> E[cupboard serve<br/>checks Host, adds key]
E --> F[Upstream API<br/>https only]
end
There are no release binaries yet. To build from source, install Go 1.27 or later and run:
go install github.com/The-Pulse-Engine/API-Cupboard/cmd/cupboard@latest
The cupboard binary goes into the bin folder of go env GOPATH. On Linux, read Platform notes first.
cupboard add openai
# Prompts for the key and the upstream URL, for example https://api.openai.com
Add a cupboard.toml file to your project. It contains no secrets, so you can commit it.
[env]
OPENAI_API_KEY = "openai"
STRIPE_SECRET_KEY = "stripe"
Run your project through the cupboard:
cupboard run -- npm run dev
Start the proxy:
cupboard serve
Point your SDK at the cupboard. Most SDKs need a key value, so give a dummy value:
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:9090/openai/v1", api_key="unused")
The proxy removes the dummy key and adds the real key. Streaming works through the proxy, and each token arrives as soon as the upstream sends it:
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Count from 1 to 10."}],
stream=True,
)
for chunk in stream:
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)
print()
The proxy refuses calls from web pages (requests with an Origin header) with 403. If a page of your own must call a shelf, add its origin to the shelf's allow_origins list in shelves.json, for example "allow_origins": ["http://localhost:3000"].
Start cupboard serve and open the link that it prints, for example http://127.0.0.1:9090/?token=.... The token changes each time cupboard serve starts. If the output goes to a file and not to a console, cupboard serve prints the path of the ui-link file instead, which holds the same link. A desktop icon that does both steps is planned.
When you change the upstream URL of a shelf, the UI asks you to confirm, because the key then goes to the new server.
| Command | Description |
|---|---|
cupboard add <shelf> | Add a key and its upstream settings |
cupboard list | Show all shelves (never shows key values) |
cupboard remove <shelf> | Delete a shelf and its key |
cupboard run -- <cmd> | Run a command with keys as env vars |
cupboard serve | Start the proxy and the web UI |
127.0.0.1.Host headers and browser requests, to stop DNS rebinding and malicious websites.cupboard serve starts, and it accepts changes only from its own page.https:// upstreams and never appear in logs.Known limit: any program that runs as your user account can call the proxy or cupboard run. API Cupboard protects your keys from your repos, logs and network. It does not protect them from malware on your machine.
To report a vulnerability, read SECURITY.md.
Windows 11: a shortcut with the icon on the desktop and in the Start menu is planned.
Linux: a Secret Service provider (gnome-keyring or kwallet) must be running. On Arch Linux, install and start gnome-keyring in your graphical session:
sudo pacman -S --needed gnome-keyring
eval "$(gnome-keyring-daemon --start --compone
ui: a Clear log button for the request log
https://github.com/The-Pulse-Engine/API-Cupboard/issues/43
Labels: enhancement, good first issue, easy
cli: shell completion for bash, zsh and PowerShell
https://github.com/The-Pulse-Engine/API-Cupboard/issues/42
Labels: enhancement, good first issue, easy
cli: cupboard rename
https://github.com/The-Pulse-Engine/API-Cupboard/issues/41
Labels: enhancement, help wanted, medium
cli: tell Git Bash users to use winpty for the hidden key prompt
https://github.com/The-Pulse-Engine/API-Cupboard/issues/40
Labels: enhancement, good first issue, easy
cli: cupboard doctor to check the setup
https://github.com/The-Pulse-Engine/API-Cupboard/issues/39
Labels: enhancement, help wanted, medium
cli: cupboard list --json for scripts
https://github.com/The-Pulse-Engine/API-Cupboard/issues/38
Labels: enhancement, good first issue, easy
Release check: clean installs and definition of done
https://github.com/The-Pulse-Engine/API-Cupboard/issues/25
Labels: documentation
release: GoReleaser binaries on GitHub Releases
https://github.com/The-Pulse-Engine/API-Cupboard/issues/24
Labels: enhancement, help wanted, medium
docs: update the README for v1.0.0
https://github.com/The-Pulse-Engine/API-Cupboard/issues/23
Labels: documentation, help wanted, easy
docs: write docs/threat-model.md
https://github.com/The-Pulse-Engine/API-Cupboard/issues/22
Labels: documentation, help wanted, easy
Thank you for your interest. This file tells you how to report problems and send changes.
docs/project-plan.md. It defines the scope.v2-ideas issue. Do not send a pull request for them.SECURITY.md.Open an issue and include:
cupboard --version.Do not paste API keys, tokens or the contents of your keychain.
Requirements:
go.mod)gnome-keyring or kwallet)git clone https://github.com/<owner>/api-cupboard.git
cd api-cupboard
go build ./...
go test ./...
Fork the repository and create a branch from main.
Keep each pull request to one change.
Run these commands before you push:
gofmt -l .
go vet ./...
go test ./...
Add tests for new behavior. Changes to internal/proxy or internal/ui must include tests for the security checks they touch.
Write a clear pull request title and describe what changed and why.
Use a short summary line in the imperative mood, for example:
proxy: reject requests with unknown Host header
When you contribute, you agree that your contribution is licensed under the MIT License.