Freeway: self-hosted OpenAI-compatible gateway for free-tier providers
One endpoint in front of every free LLM tier, with automatic failover and no provider key ever leaving the box. Providers are data, not code: adding one is a JSON file plus an env var, never a TypeScript change. Ships 12 providers pre-written; `verify-provider --apply` derives the live model list from your own key. - core: registry, bucketed quota meter (rolling + UTC-calendar windows), key-pool store, 6-step model router with diagnostic rejection reasons - gateway: node:http, failover that commits to a stream only after 200 headers, SSE passthrough with usage sniffing, virtual keys with admin/inference roles - context engine: sqlite sessions and a 5-rung refit ladder, so a 128k thread keeps working when it fails over to an 8k model - cache: exact (sha256, safe-by-default) + opt-in semantic (flat Float32Array) - guard: inbound limits, quota forecasting, limit calibration from upstream headers, key health, secret/PII/injection scanning - dashboard: one self-contained HTML file, live SSE request log, token usage - sdk: zero-dep typed client, drop-in for the OpenAI SDK Zero runtime dependencies. 326 tests, 27-check smoke suite against a scripted mock upstream so routing is testable without spending quota. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
commit
cb985dcf9c
86 files changed
+16350
No files matched your search
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"$schema": "./_schema.json",
|
||||
"id": "cloudflare",
|
||||
"label": "Cloudflare Workers AI",
|
||||
"docs": "https://developers.cloudflare.com/workers-ai/models/",
|
||||
"console": "https://dash.cloudflare.com/profile/api-tokens",
|
||||
"enabled": true,
|
||||
"priority": 20,
|
||||
"adapter": "openai",
|
||||
"baseUrl": "https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/ai/v1",
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"envKeys": ["CLOUDFLARE_API_TOKEN"]
|
||||
},
|
||||
"limits": {
|
||||
"creditsPerDay": 10000,
|
||||
"creditsPerRequest": 15
|
||||
},
|
||||
"limitsSource": "docs",
|
||||
"verifiedOn": "2026-08-16",
|
||||
"modelsEndpoint": null,
|
||||
"modelsPath": "data[].id",
|
||||
"dropParams": [],
|
||||
"headers": {},
|
||||
"notes": "Free tier is 10,000 neurons/day (confirmed on the pricing page), metered per token rather than per request. Per-model neuron rates come straight from Cloudflare's published table; note output tokens cost roughly 7-10x input, which is why rates are per-model rather than one flat number. limits.creditsPerRequest is only a fallback for models without published rates. Model ids contain '/', which is why provider/model pins split on the FIRST slash only. The OpenAI-compatible surface exposes /chat/completions and /embeddings but not /models, hence modelsEndpoint: null.",
|
||||
"models": [
|
||||
{
|
||||
"id": "@cf/meta/llama-3.1-8b-instruct",
|
||||
"label": "Llama 3.1 8B Instruct",
|
||||
"alias": ["cheap"],
|
||||
"context": 8192,
|
||||
"caps": ["chat", "code"],
|
||||
"priority": 30,
|
||||
"credits": { "perMTokIn": 2457, "perMTokOut": 18252 }
|
||||
},
|
||||
{
|
||||
"id": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
|
||||
"label": "Llama 3.3 70B Instruct (fp8 fast)",
|
||||
"alias": ["big"],
|
||||
"context": 24000,
|
||||
"caps": ["chat", "tools", "code"],
|
||||
"priority": 20,
|
||||
"credits": { "perMTokIn": 26668, "perMTokOut": 204805 }
|
||||
},
|
||||
{
|
||||
"id": "@cf/meta/llama-3.2-3b-instruct",
|
||||
"label": "Llama 3.2 3B Instruct",
|
||||
"alias": [],
|
||||
"context": 8192,
|
||||
"caps": ["chat"],
|
||||
"priority": 40,
|
||||
"credits": { "perMTokIn": 2457, "perMTokOut": 18252 }
|
||||
},
|
||||
{
|
||||
"id": "@cf/mistralai/mistral-small-3.1-24b-instruct",
|
||||
"label": "Mistral Small 3.1 24B",
|
||||
"alias": [],
|
||||
"context": 128000,
|
||||
"caps": ["chat", "tools", "long-context"],
|
||||
"priority": 25
|
||||
},
|
||||
{
|
||||
"id": "@cf/zhipu/glm-4.7-flash",
|
||||
"label": "GLM 4.7 Flash",
|
||||
"alias": [],
|
||||
"context": 131072,
|
||||
"caps": ["chat", "tools", "reasoning", "long-context"],
|
||||
"priority": 25
|
||||
},
|
||||
{
|
||||
"id": "@cf/baai/bge-large-en-v1.5",
|
||||
"label": "BGE Large EN v1.5",
|
||||
"alias": ["embed-large"],
|
||||
"context": 512,
|
||||
"caps": ["embed"],
|
||||
"priority": 20,
|
||||
"credits": { "perMTokIn": 18582 }
|
||||
},
|
||||
{
|
||||
"id": "@cf/baai/bge-small-en-v1.5",
|
||||
"label": "BGE Small EN v1.5",
|
||||
"alias": [],
|
||||
"context": 512,
|
||||
"caps": ["embed"],
|
||||
"priority": 30,
|
||||
"credits": { "perMTokIn": 1841 }
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user