C.W.K.
Lesson 02 of 06 · published

Codex Variant — OAuth + Direct httpx

~13 min · codex, openai, oauth

Level 0Curious
0 XP0/52 lessons0/16 achievements
0/100 XP to next level100 XP to go0% complete

ChatGPT Pro OAuth, no openai SDK

Codex-Pippa doesn't use the openai Python SDK. It reads the Codex CLI's OAuth session, refreshes the JWT via the OpenAI token endpoint, and streams from the provider's response endpoint via httpx SSE.

Why direct httpx

The openai SDK doesn't speak the Codex backend API directly — that endpoint is the one ChatGPT itself uses. Going around the SDK gives us full control over wire format quirks (instructions field, store: false, max_output_tokens unsupported).

Multi-turn function calling

No server-side session resume. Each turn replays full history. Tool calls go through cwkPippa's local tool_bridge.py — same code path as Claude. The only variant-specific part is wire-format conversion (OpenAI tool schema instead of Claude's).

War story: Codex's wire format had three surprises: instructions required as top-level (not developer role in input), store: false mandatory, max_output_tokens unsupported. Each one was a 400 error until we matched the exact wire format ChatGPT itself sends.

Progress

Progress is local-only — sign in to sync across devices.