Skip to content

agent-memory-api: OPENROUTER_BASE hardcoded — same generalization argument as entity-extraction-worker #315

Description

@jkdavies

At commit `151a8d1c922ffadad08399508efe46b207a5894e`:

```ts
// integrations/agent-memory-api/index.ts:7-10
const SUPABASE_URL = Deno.env.get("SUPABASE_URL")!;
const SUPABASE_SERVICE_ROLE_KEY = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
const OPENROUTER_API_KEY = Deno.env.get("OPENROUTER_API_KEY")!;
const MCP_ACCESS_KEY = Deno.env.get("MCP_ACCESS_KEY")!;
const OPENROUTER_BASE = "https://openrouter.ai/api/v1\";
```

Same shape as #313 — the base URL is a string literal where the API key is env-driven. Self-hosted deployments that want to route through LiteLLM (or another OpenAI-compatible gateway) currently have to fork to flip the URL.

Suggested patch

```ts
const OPENROUTER_BASE = Deno.env.get("OPENROUTER_BASE") ?? "https://openrouter.ai/api/v1\";
```

(Or rename to `CHAT_API_BASE` to mirror the MCP server's convention, which already supports env override.)

Default behavior unchanged for OpenRouter-default deployments.

Context

Self-hosted at Davies Farms — see #313 + #314 (the other two surface-area items). All three are the same generalization argument: the upstream default to a specific SaaS endpoint is fine, but a one-line env-override unblocks any non-default deployment without changing default behavior.

Happy to PR all three together as a single "env-overridable base URLs" PR if you'd prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions