Billable Tokens
Built at Global Codex Hackathon: [San Francisco] · Apr 16, 2026 · San Francisco, CA

Adaptive Codex is a Python CLI on top of the OpenAI API that routes every coding turn to the cheapest viable GPT-5.4 tier while preserving conversation context across model switches. The result is a coding session with the cost discipline — cheap tasks go to cheap models, hard tasks still get the frontier model, and the router learns from what actually happened instead of what someone wrote in a regex. Key features: 1. Portable conversation state. The app owns raw API output items in SQLite and passes them forward as input[] on every call, so context survives model switches without previous_response_id — a turn handled by nano is visible to a later turn on the frontier model. 2. Plugin-scoped taxonomy and memory. Task families are registered per plugin via routing/taxonomy.py; each plugin gets its own FAISS index and MemoryStore implementation (Protocol-defined). Another team can drop in a plugin='testing' or plugin='sql' and reuse the whole loop without touching the core. 3. Smart Retrieval-augmented LM routing. Every prompt is embedded (text-embedding-3-small), SHA-256-hashed for dedup, and indexed in a per-plugin FAISS IndexIDMap2 wrapping IndexFlatIP (inner product = cosine similarity on normalized vectors). gpt-5.4-nano sees the top-k neighbors and returns a typed RoutingProposal with model, task_type, task_family, memory_key, reasoning, confidence — enforced via Pydantic AI structured output. 4. Graceful degradation at every layer. Embedding failure → zero vector. FAISS missing → no neighbors. LM failure → neighbor-majority fallback. The CLI never sees an exception from route() — an engineering team running this in production doesn't get paged because the classifier had a bad day. 5. Tool-item continuity. function_call / shell_call / local_shell_call / apply_patch_call items and their matching outputs are persisted verbatim, so tool context carries across model swaps as well. 6. Lightweight stack. Python CLI + SQLite (WAL) + FAISS + vanilla HTML/JS dashboard. No training pipeline, no orchestration framework, no platform migration.