feat: replace LLM provider with Sakana Fugu (straight swap)

✅ merged · #1 · jmclark-lab/mike ← jmclark-lab/mike · opened 25d ago by jmclark-lab · merged 25d ago by jmclark-lab · self · +724-13 across 10 files · ↗ on GitHub

From the PR description

Summary

Replaces the existing LLM provider with Sakana AI's Fugu model - a straight permanent swap, no feature flag.

Changes

  • backend/src/lib/llm/sakana.ts - Sakana Fugu adapter (OpenAI Chat Completions-compatible, streaming SSE)
  • backend/src/lib/llm/{types,models,index}.ts - provider abstraction layer; completeText and streaming route to Sakana
  • backend/src/routes/chat.ts - stamps provider_metadata: { provider_name, model_name } on every assistant chat_messages insert (success, abort, and error paths) via SAKANA_PROVIDER_METADATA constant
  • backend/src/index.ts - startup guard: server refuses to boot without SAKANA_API_KEY
  • supabase/migrations/20260623000000_add_provider_metadata.sql - adds provider_metadata JSONB column to chat_messages
  • backend/src/lib/llm/__tests__/sakana.test.ts - unit tests for the adapter
  • backend/.env.example and backend/README.md updated

Deployment checklist

  1. Run the migration before deploying the new backend
  2. Set SAKANA_API_KEY in Railway (Settings → Variables)
  3. Optionally set SAKANA_MODEL (defaults to fugu-ultra-20260615)
  4. Remove any legacy FUGU_API_KEY or LLM_PROVIDER env vars after merge

Cost note

Sakana Fugu is priced at $5 / M input tokens and $30 / M output tokens.

Our analysis

Swap the LLM provider to Sakana AI's Fugu model — read the full analysis →

Think the analysis missed something the PR description covers?

Commits in this PR (10)

SHA Subject Author Date
108d290d feat: types.ts - Provider=sakana, UserApiKeys.sakana Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
f18e6ea6 Add Fugu models and update model provider function Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
1ace046e Update index.ts Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
303b65d0 Update index.ts Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
89735836 Update .env.example Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
3e3b6946 Create README.md Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
fe2ca9ed Create sakana.ts Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
f9ddb40a Add tests for streamSakana and completeSakanaText Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
45e56f21 feat(chat): persist Sakana Fugu provider_metadata on assistant messages Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
882fb97e feat(db): add provider_metadata column to chat_messages Julio G. Martinez-Clark 2026-06-23 ↗ GitHub
This migration adds a new column 'provider_metadata' to the 'chat_messages' table to store information about the LLM provider and model used for each assistant response.

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-1.md from inside the repo you want the changes in.

⬇ Download capture-pull-1.md