Skip to content

feat: vet OpenRouter as a second BYOK embedding provider - #142

Open
EthanThatOneKid wants to merge 1 commit into
mainfrom
openrouter-provider
Open

EthanThatOneKid wants to merge 1 commit into
mainfrom
openrouter-provider

Conversation

@EthanThatOneKid

Copy link
Copy Markdown
Contributor

What

BYOK was hard-wired to OpenAI. This makes the provider a property of the model and adds OpenRouter as a vetted second provider.

  • catalog.ts: provider table (EMBEDDING_PROVIDERS, fixed endpoint per provider, still no customer-supplied host); new models openrouter/openai/text-embedding-3-small and -large (dimensions pinned to 1536).
  • openai.ts becomes provider.ts; the client picks its endpoint from the model's provider.
  • A namespace can hold one credential per provider. The decrypted-key cache is now keyed by namespace and provider (it was keyed by namespace only, which would have crossed providers). Revoking one provider only stales worlds on that provider's models.
  • World create/PATCH and reindex check the credential of the chosen model's provider, not just "any credential".
  • GET/DELETE /namespaces/{ns}/embedding-credential take an optional ?provider=. It may be omitted while one live credential exists (existing callers keep working); with two live credentials it returns 400 until provider is given.
  • Status lookup in store.ts no longer hard-codes provider = 'openai'.

Contract change and dependents

Additive OpenAPI change: new provider and embeddingModel enum values, new optional query parameter, new 400 on GET/DELETE.
Dependents, in merge order: this PR -> worlds-client-ts (regenerate and publish) -> wazoo-api round-trip script (add a provider switch) -> wazoo-console if it lists providers.

Not observed

Tests use a fake fetch; I have not called OpenRouter. The OpenRouter embeddings endpoint is OpenAI-format and its model list includes openai/text-embedding-3-small/large, but that dimensions: 1536 is honoured through OpenRouter is unverified until the QA round-trip runs with a real OpenRouter key.

Checks

230 tests pass (new: OpenRouter client, per-provider keys and cache, scoped revoke, ambiguous GET/DELETE, PATCH needs the model's provider credential), tsc, prettier, OpenAPI snapshot regenerated.

🤖 Generated with Claude Code

A namespace now holds one credential per provider; a world's model picks the
provider. Adds openrouter/openai/text-embedding-3-{small,large}, a per-provider
endpoint table, a per-provider key cache and revoke scope, and an optional
?provider= on GET/DELETE embedding-credential (required once two are live).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant