AI SDK Codex Subscription Provider
I built this experimental provider to connect Vercel's AI SDK to a local Codex subscription. It lets developers use familiar SDK calls to build their own agents and interfaces.
The SDK's OpenAI provider and the Codex backend use related protocols with important differences. I reused the upstream provider and built a compatibility layer to handle those differences, including streaming and reasoning across turns. The provider also supports image generation and editing through the SDK.
I designed authentication so applications can build their own login experience. The API offers browser and device login helpers, while a small credential store interface lets an application choose where credentials live. A file store is included for the common case; it uses private permissions, atomic writes and a lock to coordinate token refreshes.