AI gateway · control plane
El-Camino
Your team's AI, on one key. A secure gateway where master keys never leave the control plane and every developer gets a budget-capped, rate-limited, instantly revocable key, with Token Saver and an 84% prompt-cache hit rate cutting the bill.
Overview
El-Camino is a key firewall between 500+ developers and an organisation’s AI provider accounts. The real provider master keys live only inside the gateway. Each developer gets a virtual key, and that is all that ever sits on a laptop, in a .env file, in a CI config or in a Claude Code setup. It started as one engineer’s project and is now used company-wide.
Why it is a security story
- A smaller blast radius. One leaked master key exposes a whole company account. A leaked virtual key exposes one developer’s allowance, and that key has walls around it.
- Budget caps and rate limits. Every key has its own budget cap, enforced before each call, so even a stolen key can only spend its allowance before it stops. Redis-backed rate limits stop high-volume scraping and token-draining loops.
- Attribution. Every request is tied to a developer in the token ledger, so unusual behaviour shows up right away: a key suddenly active at 3 AM, a spike in volume, an odd model mix.
- Instant revocation. One key can be killed without rotating provider credentials or disrupting anyone else. Offboarding works the same way: revoke the key and access ends at that moment, with no shared secret left behind.
- Secure by default. API keys are stored only as hashes, provider credentials are encrypted, keys can be restricted to named models, and two-factor authentication can be required for everyone.
- Governance from the same structure. Tier routing doubles as access policy: who gets the most capable models and who stays on cheaper tiers is enforced centrally. One choke point means one place to audit, set policy and switch providers, with no change on the developer side.
How it works
- Entry: one Anthropic-compatible endpoint, seven providers behind it: Anthropic, OpenAI, Gemini, OpenRouter, Ollama, Azure OpenAI and AWS Bedrock. Developers use their own keys, so tools like Claude Code, Codex CLI, Gemini CLI and VS Code work unchanged.
- Auth and policy: resolves the key to a developer, checks the budget cap and enforces Redis-backed rate limits.
- Routing: maps each request to one of three model tiers and picks a provider. Accounts bundle into routing groups, with automatic failover on quota or auth failure and model fallback chains when no account can serve a model.
- Transformation: before forwarding, Token Saver trims what each request sends, a cost notice is added past 50K input tokens, and cache markers are kept intact so provider prompt caching keeps working.
- Streaming: relays responses back and retries mid-stream failures.
- Accounting: writes every request into a per-developer token ledger, priced per million tokens including cache read and write, which feeds budgets, reports and attribution.
Around that: monthly budgets per project or team alert at 80% and 100% and can stop spending at the limit, usage and savings reports can be downloaded as CSV or emailed on a schedule, and operations cover OAuth expiry tracking, per-account issue alerts, audit logs, and Mattermost, Telegram and email integrations.
Cost control as a side effect
The gateway also cuts the bill: an 84% cache hit rate, Token Saver (long tool output filtered, earlier conversation compressed, repeated text sent once, uniform JSON sent as a table, all deterministic so caching still works), cost notices on heavy prompts, and catching problems such as OpenRouter stripping cache_control, which a generic gateway would pass through silently.
Scale (from the live service)
1.4M all-time requests across 52 models.
Architecture
A request enters through an Anthropic- or OpenAI-compatible endpoint, is checked against the caller’s virtual key, routed to an account with capacity, trimmed by Token Saver, streamed back and written to the ledger.
Six steps, in this order
- 01Key check
Whose key it is, which models it may use, which addresses it may call from, how many requests it may run at once, and whether its daily or total spend cap is already reached. A refused request never reaches a provider.
- 02Token Saver
RTK filters long tool output and a prompt compressor shortens earlier conversation. Both are deterministic, so the provider’s prompt cache still matches.
- 03Account pick
From the key’s routing group, spread by a weighted load balancer and pinned per session so the provider cache stays warm.
- 04Relay and stream
The reply streams back over SSE as the provider writes it. If the account is busy or down, the request moves to another, up to twice, before an error is shown.
- 05Plain errors
When every account fails, the message says what happened and what to do next. Spend limits and blocked models are policy, so they are never retried.
- 06Ledger
Tokens and cost recorded against the key and model, with cache read and write priced separately. This feeds budgets, reports and attribution.
Trust boundary
Only a virtual key ever leaves the control plane. Provider master keys stay encrypted inside it, so a leaked key exposes one developer’s allowance, and revoking it ends access at once.
Virtual keys
Stored only as hashes. Shown once at creation. Optional expiry; can be disabled or revoked individually.
Provider credentials
Encrypted with AES-256-GCM. OAuth tokens are renewed before they expire, and expiry is tracked per account.
Per-key limits
Daily and total spend caps checked before the call, a concurrency limit (5 by default), a model allow-list and an optional IP allow-list.
Rate limiting
Redis-backed, answered with 429 and a Retry-After header so SDKs and Claude Code back off by themselves.
Sign-in
EchoSSO single sign-on across the company’s tools, with two-factor authentication that can be required for everyone.
Audit
Audit log of administrator changes, a query log, usage by key, model and person, and a live map of connections.
Developer experience
Two commands put Claude Code and Codex behind the gateway. The same key works from an SDK by changing only the base URL.
# install and sign in once
$ npm install -g @indianic/elcamino
$ elcamino login
✔ Signed in.
$ elcamino shell
✔ elcamino-claude → claude through the gateway
✔ elcamino-codex → codex through the gateway /v1 $ curl $BASE/v1/messages \
-H "x-api-key: $ELCAMINO_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{"model": "claude-haiku-5-5",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Hello"}]}'
{ "type": "message", "role": "assistant",
"stop_reason": "end_turn",
"usage": {"input_tokens": 9, "output_tokens": 12} } API surface
| Method | Path | What it is | Auth header |
|---|---|---|---|
POST | /v1/messages | Anthropic Messages API, unchanged. Tools, images, system prompts and streaming work as upstream; anthropic-beta values pass through. | x-api-key |
POST | /v1/chat/completions | OpenAI Chat Completions, for the OpenAI SDKs and tools built on them. | Authorization: Bearer |
POST | /v1/responses | OpenAI Responses API, used by Codex and similar clients. | Authorization: Bearer |
GET | /v1/models | Models this key may use right now: allowed by its permissions and servable by at least one active account. | either header |
Streaming uses text/event-stream: Anthropic events on /v1/messages, OpenAI chunks on /v1/chat/completions, with a : ping comment while the model is quiet so proxies keep the connection open. Request bodies up to 10 MB.
Errors say what to do
| Status | Cause | Caller action |
|---|---|---|
400 | Malformed request, unknown model, invalid JSON | Fix the model id or body |
401 | No key sent, or an unknown key | Check ELCAMINO_API_KEY |
403 | Key disabled or expired, IP not allowed, provider or model not permitted | Ask an administrator |
413 | Request body above 10 MB | Send less per request |
429 | Rate limit (Retry-After set) or spend cap (no Retry-After) | Wait, or raise the cap |
5xx | Model unavailable or upstream failure (502, 503, 504) | Retry with backoff |
Token Saver
Four savers cut what each request sends. Every step is deterministic, so identical prompts stay identical and provider prompt caching keeps working. They can be switched on globally, per key or per routing group, with savings reported day by day.
Output filter (RTK)
Long tool output is filtered before it is sent upstream.
Prompt compression
Earlier conversation is compressed, keeping the recent turns intact.
Repeat removal
Text that repeats within a request is sent once.
Tabular JSON
Uniform JSON arrays are sent as a table instead of repeated keys.
Operations
Routing groups
Pool accounts for balancing and failover; set globally, per key or per group.
Fallback chains
When no account can serve a model, the next model in its chain answers instead of an error. Blocked models are never used.
Budgets
Monthly dollar budgets per project or team alert at 80% and 100% and can stop spending at the limit.
Reports
Usage and savings for any period, as CSV or emailed daily, weekly or monthly, every row linked to its detail.
Health
Every provider account on one page; errors explain the cause and the fix in plain language.
Notifications
Per-account issue alerts to Mattermost, Telegram and email.