Skip to main content

Keyladder: all your AI API keys, one local address

When one free AI key runs out, Keyladder tries the next, and it never spends money you didn't approve.

License: Apache 2.0 Python 3.12 or newer Runs on your machine No telemetry

Quick start · How it works · Screenshots · Works with · FAQ · Docs

Why Keyladder?

You have a Groq key, a Gemini key or two, an OpenRouter key, maybe more. Each free plan has its own limits, so sooner or later one says "too many requests" and your app stops. So you write retry code in every project, and still can't tell which key answered or whether anything cost money.

Keyladder runs on your own computer and holds all those keys. Your apps send requests to it as they would to OpenAI. It tries your keys in your order until one answers, skips anything that would break a limit or cost money, and writes down why.

Before: every project carries its own retry loop.

for key, model in my_keys:
    try:
        reply = call(key, model, messages)
        break
    except RateLimitError:  # "too many requests"
        continue  # which key answered? did it cost money?

After: every project talks to Keyladder, which handles the keys, the limits and the retries.

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="kl-...")  # your Keyladder key
reply = client.chat.completions.create(model="auto", messages=messages)

Try it with Docker, using built-in fake providers (no account needed):

git clone https://github.com/sukumarmuthusamy/keyladder.git && cd keyladder
KEYLADDER_DEMO=true docker compose up -d --build && docker compose logs gateway

Open the setup link it prints. The Quick start covers uv, Windows and adding your real keys.

See it in action

Screen recording: the overview, reordering the ladder, a simulator dry run, and the trace of a real request that fell back from Groq to Gemini

A real recording with free-tier keys. In the trace at the end, Keyladder's own per-minute limit on the Groq key (set low for this demo) skipped both Groq models without calling them, gemini-2.5-flash returned a real 404, and gemini-3.5-flash-lite answered, all within one request. Watch as video.

How it works

Illustration: key 1 has had too many requests, key 2 has used up its daily limit, key 3 answers, and the trace records each step

You put your keys in order once (several per provider is fine, each with its own limits). Then, per request:

  1. Your app sends a normal request to Keyladder, using a Keyladder key instead of a provider key.
  2. Keyladder climbs the ladder. It skips any key that is busy, out of allowance, missing something the request needs, or would cost money. The first key that can answer does.
  3. Every step is written down in a trace: which keys were tried, why each was skipped, how long it took and what it cost (on free plans, $0).
Words used on this page
  • Provider: a company that runs AI models behind an API, such as Groq or Google Gemini.
  • Free tier: a provider's free plan, with daily or per-minute limits.
  • Token: a piece of a word; providers count and limit usage in tokens.
  • Tools: functions an AI model can ask your program to run (also called function calling).
  • Trace: Keyladder's record of how one request was handled.
  • Route: a named ladder your apps can ask for, such as model="free-ladder"; auto uses all your keys.

What you get


Your keys, in your order
Drag keys into the order you want them tried, across providers. Route changes can be tested before they go live.

No surprise bills
Paid models stay off until you allow them in three places. Free never quietly turns into paid.

Limits you set
Requests, tokens, cost and requests at the same time, per key, app or provider account. Keys on one account can share one allowance.

Careful retries
Moves on when a key is busy or broken, but never resends a rejected request or replays a half-sent answer.

See every decision
A trace per request, usage and speed per provider, a simulator for dry runs and a playground.

Works with your tools
Speaks OpenAI's and Anthropic's API, so existing apps and agents only need a new address.

How it all works in detail: architecture, routing, limits.

Quick start

You need uv (it fetches Python 3.12+ for you) and Node.js 22.12+ to build the dashboard, or just Docker.

1. Get the code

git clone https://github.com/sukumarmuthusamy/keyladder.git
cd keyladder

2. Start it

With uv (macOS, Linux, or Windows with Git Bash/WSL):

uv sync --locked
cd web && npm ci && npm run build && cd ..
uv run keyladder serve --demo
Windows PowerShell

Windows PowerShell 5.1 has no &&, so run one command per line:

uv sync --locked
cd web
npm ci
npm run build
cd ..
uv run keyladder serve --demo

scripts\dev.ps1 wraps the same steps (bootstrap, web, dev).

With Docker (any system):

KEYLADDER_DEMO=true docker compose up -d --build
docker compose logs gateway

In PowerShell, run $env:KEYLADDER_DEMO = "true" first, then the two docker compose commands.

Keyladder now runs at http://127.0.0.1:8787, reachable from your computer only. On first start it prints a one-time setup link (in the terminal, or in docker compose logs gateway). Open it and create your owner account. Missed it, or it expired after 24 hours? Run uv run keyladder reset-owner (Docker: docker compose exec gateway keyladder reset-owner).

Demo mode (--demo or KEYLADDER_DEMO=true) adds clearly labelled fake providers to try things with. Remove them later with uv run keyladder demo --remove.

3. Add your keys and send a request

Add provider keys in the dashboard (Providers & Credentials → Add credential), or, with uv, as environment variables (or in a .env file) before starting:

export KEYLADDER_CREDENTIAL__GROQ__PERSONAL=gsk_...
export KEYLADDER_CREDENTIAL__GEMINI__WORK=AIza...
The same in Windows PowerShell
$env:KEYLADDER_CREDENTIAL__GROQ__PERSONAL = "gsk_..."
$env:KEYLADDER_CREDENTIAL__GEMINI__WORK = "AIza..."

These become groq/personal and gemini/work, with paid usage off. Then, under Projects & Keys, create a project and a Keyladder key (shown once; in demo mode use the demo project), and point any OpenAI client at Keyladder:

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="kl-...")

reply = client.chat.completions.create(
    model="auto",  # let Keyladder pick from your ladder
    messages=[{"role": "user", "content": "Hello!"}],
)
print(reply.choices[0].message.content)

model="auto" uses your whole ladder. You can also pin a model you have a key for, such as model="groq/openai/gpt-oss-120b", or name a route. Every reply says what served it:

x-keyladder-provider: groq
x-keyladder-model: openai/gpt-oss-120b
x-keyladder-credential: personal

The dashboard's Traces page shows the full story.

PostgreSQL, backups and upgrades: deployment and operations.

Screenshots

Real captures after two days of light free-tier traffic through five providers. They follow your light or dark setting.

Trace: two Groq models skipped by a per-minute limit, a retired Gemini model failed with 404, the next one answered

A trace. Read the Decision cards in order: two rejected by a limit, one failed, one succeeded.

The ladder: six keys from five providers, all healthy

The ladder. Six keys from five providers, tried top to bottom; drag to reorder.

More: playground, overview, limits Playground: a free NVIDIA model calls a get_weather tool, then answers from its result Overview: today's requests, a used-up limit, speed per provider and the next quota resets Limits: usage against each cap, with a protected reserve

Simulator, traces list and Eval Lab captures are in docs/images.

Works with

Built-in support for the providers below, plus Ollama, any OpenAI-compatible server and plugins. Names are trademarks of their owners; Keyladder is not affiliated with them.

Provider Checked live with a free key on 2026-11-30
Groq Yes: chat, streaming, tools, JSON output
Google Gemini Yes, on two separate accounts: chat
OpenRouter (:free models) Yes: chat, streaming, tools, JSON output; a paid model was refused before sending
NVIDIA (hosted API catalog) Yes: chat, streaming, tools, JSON output
Cloudflare Workers AI Yes: chat, streaming
Hugging Face Checked: free accounts can't use its router (it asks for pre-paid credits)
Cerebras Checked: free access now needs a payment method
OpenAI, Anthropic, Mistral, DeepSeek, Together, Cohere, SambaNova Not yet (no free key); built from their docs

"Yes" means each feature worked at least once that day through the real API: a record of one day, not a promise. Full results, including failures: live results.

How it's tested

Besides the test suite, two tools replay scripted failures against a stand-in provider. They measure Keyladder's decisions, not real-provider speed or model quality.

  • uv run keyladder eval run: the recorded run (commit 675d5d4, 2026-12-01) passed 56 scenarios (1 skipped) and 1,084 of 1,084 checks, with 0 budget violations and 0 secret leaks.
  • uv run keyladder bench: the same 16 requests and failures through three setups. The recorded run (commit 675d5d4, 2026-12-01):
Keyladder Naive Direct
Correct* 16/16 8/16 8/16
Answered 11/16 16/16 8/16
Unsafe retries 0 3 0
Over budget 0 2 2
Paid at $0 budget 0 1 0

* Graded by Keyladder's own rules: no free-to-paid fallback, no retry after an invalid request, a read timeout or a half-sent stream, no going over budget. "Naive" (next provider on any error) and "Direct" (one provider) are minimal clients written for this test, not other products. Naive answered more by breaking those rules; Keyladder's five refusals were correct. The cost: about 18 ms added per request (median; 28 ms at p95) on SQLite, on a shared 4-CPU cloud machine. Method and caveats: docs/evaluation.md, docs/benchmarks.md.

FAQ

Is it free?

Yes, open source under Apache 2.0. Provider pricing is up to them; Keyladder keeps you inside your free plans.

Can it spend my money?

Not unless you say so three times: the global paid switch is on, that key may spend, and the model has a price you entered (the catalog leaves prices empty on purpose). A free request never falls back to a paid model unless a route says so, and you can cap spending per key or project.

Does it store my prompts?

Not unless you turn that on. Traces keep the facts (keys tried, model, timings, tokens, cost, errors), not the text, for 14 days by default. The opt-in content capture setting, for debugging, also keeps messages and replies, with known secrets replaced by [REDACTED], for 24 hours by default. All of it stays on your machine.

Is it safe to run?
  • It listens only on 127.0.0.1 by default: nothing outside your computer can reach it.
  • Provider keys are encrypted at rest (AES-256-GCM, rotatable master key) and never shown again; Keyladder keys are stored only as hashes.
  • Sign-in uses Argon2id, strict cookies, CSRF and Origin checks, and login throttling. Backups are tamper-checked, with secrets still encrypted inside.
  • No telemetry: the only outside calls go to the providers you set up.

For use from other machines, put TLS in front and read the threat model. Report vulnerabilities via SECURITY.md.

What if a provider changes its limits?

Keyladder's limits are your own numbers: set them a little below the provider's and change them any time. If a provider refuses requests anyway, Keyladder rests that key for as long as the provider asks and moves on.

How is this different from LiteLLM or OpenRouter?

OpenRouter is a hosted service: you reach many models through its key and its billing. Keyladder runs on your machine with your own keys from each provider (an OpenRouter key can be one of them). LiteLLM is a broad proxy and SDK for many providers. Keyladder is narrower: a strict ladder of your own keys, shared allowances for keys on one account, limits reserved before anything is sent, paid usage off by default, and a trace for every decision.

Does it work with my agent or tool?

If it lets you set an OpenAI or Anthropic base URL, very likely: Keyladder speaks OpenAI Chat Completions (streaming, tools, JSON mode), Anthropic Messages, embeddings and /v1/models (details).

Is it ready?

It is pre-1.0: everything here is built and tested against scripted providers, and five providers were checked live. Expect rough edges; see the changelog.

Documentation

Start here Go deeper Testing and results
Configuration Architecture and decision records Evaluation
Deployment Routing · Quotas and limits Benchmarks
Operations API · Data model Live validation
Providers · Compatibility Threat model · Releases Live results (2026-11-30)

Contributing

Contributions are welcome. Start with CONTRIBUTING.md; the short version: no real provider keys in tests, no paid calls in CI, and a failing test first for anything security-related. Please follow the Code of Conduct.

License

Apache License 2.0. See LICENSE and NOTICE.

Metadata

Release files for keyladder 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keyladder 0.1.2
File Size Uploaded Provenance Actions
keyladder-0.1.2.tar.gz 1.6 MB With provenance Details for keyladder-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keyladder 0.1.2
File Interpreter ABI Platform Actions
keyladder-0.1.2-py3-none-any.whl Python 3 none any Details for keyladder-0.1.2-py3-none-any.whl

Total release size: 2.4 MB

Release files / keyladder-0.1.2.tar.gz

Download URL keyladder-0.1.2.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
2dd5ea48c317ef4e0ef4cc23993826c96eed483c73d31729913850ee8973f7db
BLAKE2b-256 checksum
How to use checksums
e4abeea58ec24e97f5b3b6625f78291904778376c2a529aeca19c423dea7f89d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / keyladder-0.1.2-py3-none-any.whl

Download URL keyladder-0.1.2-py3-none-any.whl
Size 779.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad0edd480dc994dd09613c6e328432b95983cb4fd9c299cd8158f2919f21dec0
BLAKE2b-256 checksum
How to use checksums
1068c42675dc087bdee9eb46bb57ac2ecb365fed93f8f6b4427b9d22923a8127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for keyladder 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for keyladder-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page