Skip to content

feat(model): bring your own key through ai-kit — every vendor, the key's own models, no paid check - #138

Merged
catomean merged 1 commit into
mainfrom
feat/byok-ai-kit
Sep 26, 2026
Merged

catomean merged 1 commit into
mainfrom
feat/byok-ai-kit

Conversation

@catomean

Copy link
Copy Markdown
Contributor

Heidi's part of the fleet-wide "make it easy to power with the smartest model you have" (George, relayed by the Loki session; reference bitbaum/loki#921).

Before (measured)

  • Heidi kept its own 5-vendor BYOK_PROVIDERS: no Anthropic, no Gemini.
  • The model was a free-text field with a guessed default.
  • /api/model/check spent a real completion to test a key.

Now

  • Vendors from @bitbaum/ai-kit BYOK_VENDORS (bumped to ^1.17.0), 10 in total:
    • OpenRouter, OpenAI, Anthropic, Google Gemini, Groq, Mistral, DeepSeek, xAI, Together, Cerebras.
    • byokChain delegates to ai-kit's. Heidi pins dailyTokens: 0 on the reader's link: ai-kit marks it unmetered, and Heidi's free chain shares provider ids, so an unmetered entry could otherwise read as capacity in our pool.
  • /api/model/check → probeByokKey
    • No tokens spent.
    • Returns the key's own models with suggested.
    • On failure: the vendor's words, redacted again here.
    • "Unreachable" is kept apart from "wrong key".
  • The sheet
    • Choose vendor → paste key → auto-check after 600 ms.
    • A select of the key's models, strongest preselected and marked ("— stärkstes").
    • Free text only when the vendor lists none.
    • Failure shows our localised sentence, then "Der Anbieter meldet: …".
    • The key stays in this browser only; unchanged privacy choice.
  • No per-vendor "text only" guess. ai-kit routes images on observed capability.
  • New strings in all 7 languages; the unused "can read pictures / text only" labels were removed.

Also fixed: "No streaks" was still claimed in 7 languages (landing pillar, method line, a sourced method claim) after streaks shipped. Reworded to what's true: no points, no invented numbers, and a streak without reproach.

Checked

  • pnpm run verify green (913 pass).
  • New route tests (probe mocked): bad input refused before any call; models and suggestion passed through; key redacted; unreachable ≠ wrong key.
    • Mutation-checked: removing the redaction fails the redaction test, and collapsing "unreachable" fails the unreachable test.
  • Browser at 390px (check endpoint intercepted):
    • 10 vendors offered; one check request 0.6 s after pasting;
    • the model select shows 3 models with claude-opus-5 — stärkstes preselected;
    • "Dieses Modell verwenden" stores {provider, key, model} in localStorage;
    • the failure shows the vendor's credit message;
    • no horizontal scroll.

🤖 Generated with Claude Code

…y's own models, no paid check

Per the Loki session's fleet-wide request (loki#921 is the reference):
- Vendors come from @bitbaum/ai-kit BYOK_VENDORS (^1.17.0): ten instead of
  Heidi's own five, Anthropic and Gemini included; byokChain delegates to
  ai-kit's (dailyTokens pinned to 0 — Heidi's free chain shares provider ids).
- /api/model/check uses probeByokKey: no tokens spent (it made a real
  completion), the key's own model list with the strongest suggested, the
  vendor's words on failure (redacted again here), 'unreachable' kept apart
  from 'wrong key'.
- The sheet: paste -> auto-check (600 ms) -> a select of the key's models,
  strongest preselected and marked; free text only when no list. The key
  stays in this browser only.
- No per-vendor 'text only' guess: ai-kit routes images on observed capability.
- Also: 'no streaks' was still claimed in 7 languages (landing pillar, method
  claim) after streaks shipped — reworded to what is true.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@catomean
catomean merged commit c19c914 into main Sep 26, 2026
1 check passed
@catomean
catomean deleted the feat/byok-ai-kit branch September 26, 2026 06:21
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