fabiotaroc adds OpenAI as a third LLM provider

fabiotaroc wired the OpenAI Responses API into Mike's provider abstraction, adding streaming, tool calling, and per-user key storage. The plumbing is additive and isolated - existing Claude and Gemini paths are untouched.

integrationinfrastructure

A new backend/src/lib/llm/openai.ts (167 lines) handles streaming, tool calls, and optional reasoning summaries via the OpenAI Responses API. index.ts routes gpt-* model IDs to it, and tools.ts gets a toOpenAIResponsesTools adapter parallel to the existing Gemini one. The Provider union and UserApiKeys type gain an "openai" arm.

Per-user key storage follows the same pattern as Claude and Gemini. Migration 001_add_openai_api_key.sql adds openai_api_key text to user_profiles. There's a minor issue: the one-shot baseline 000_one_shot_schema.sql is also patched to include the column. Fresh installs and existing DBs now have ambiguous migration paths - 001_*.sql adds the column, but so does the patched baseline. On a new install, applying 001_*.sql after the baseline will hit the IF NOT EXISTS guard silently, but the intent is muddled. Worth reverting the baseline edit in favor of a pure additive migration.

The registered model IDs - gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano - are forward-dated and don't correspond to currently available models. They'll need to be updated before this is usable.

One thing worth borrowing regardless: the updateApiKey refactor in UserProfileContext (lines 252-267) replaces a chain of binary ternaries with a per-provider lookup table. Cleaner pattern for any fork managing multiple provider keys.

So what Worth pulling if you want OpenAI parity. The LLM integration is well-isolated and merges cleanly. Two caveats: update the model IDs before deploying, and revert the baseline migration edit. The `updateApiKey` pattern is worth borrowing as a standalone improvement regardless.

View this fork on GitHub →

Spotted something wrong? Or know the PR text has fresher detail than the writeup above?

Commits in this thread

1 commit from fabiotaroc/mike, oldest first. Source extracted verbatim from the harvested git log.

SHA Subject Author Date
02111e0e Add OpenAI support, migration, model UI, and Turbopack root taro 2026-04-30 ↗ GitHub
Wire OpenAI in the LLM layer with optional user-provided keys, schema
migration, model availability/account UI updates, add next.config turbopack
root for mono-repo workspaces, and refresh deps.

Made-with: Cursor

Capture this thread into my fork

Download a single Markdown prompt that tells Claude how to port every commit above into your working tree — adapting paths and structure to match your repo. Run it via claude -p < capture-thread-141.md from inside the repo you want the changes in.

⬇ Download capture-thread-141.md