Skip to content

Commit 8a8d44f

Browse files
authored
Merge pull request #19 from Thibaultjaigu/feat/openrouter-base-url-env
Make OpenRouter base URL configurable via OPENROUTER_BASE_URL
2 parents beaad1e + 4ba2466 commit 8a8d44f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
# run everything locally through Ollama, this can be left blank.
66
OPENROUTER_API_KEY=
77

8+
# Optional: override the OpenRouter base URL. Because the provider is just an
9+
# OpenAI-compatible endpoint, you can point it at any compatible gateway and
10+
# keep using OPENROUTER_API_KEY for that gateway's key. For example, Requesty
11+
# (https://requesty.ai) — caching, failover, and cost controls, same
12+
# "vendor/model" ids:
13+
# OPENROUTER_BASE_URL=https://router.requesty.ai/v1
14+
# OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
15+
816

917
## Model defaults (optional)
1018

server/src/agent/models.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ import {
2222
REPO_ROOT,
2323
} from "../config.ts";
2424

25-
const OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1";
25+
// OpenRouter's base URL. Overridable via OPENROUTER_BASE_URL so the
26+
// OpenAI-compatible provider can point at any compatible gateway — e.g.
27+
// Requesty (https://router.requesty.ai/v1), which uses the same
28+
// "vendor/model" ids and Bearer auth as OpenRouter.
29+
const OPENROUTER_BASE_URL =
30+
process.env.OPENROUTER_BASE_URL ?? "https://openrouter.ai/api/v1";
2631
const CATALOGUE_PATH = path.join(REPO_ROOT, "web", "src", "data", "models.json");
2732

2833
interface CatalogueEntry {

0 commit comments

Comments
 (0)