Skip to content
C.W.K.
Stream
Lesson 02 of 11 · published

Codex Variant — OAuth + Direct httpx

~13 min · codex, openai, oauth

Level 0Curious
0 XP0/93 lessons0/18 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

Each turn replays full history — same as Claude does now post-2026-05-14 (see the EvNote in vessels lesson 1). Tool calls go through Codex's own tool_bridge.py, which runs Read/Write/Edit/Bash locally inside cwkPippa and leans on a small helper module the variants share. Claude is the exception here: it never goes through a tool bridge at all — its tools run natively inside the Claude Code SDK. What stays variant-specific is the 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.
Spotted a bug or have feedback on this page?Report an Issue
💛 by Pippa— warm💛 by Ttori— warm

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.