#Prompt
11 messages · Page 1 of 1 (latest)
Hi @next pike. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
You can only use the OpenAI-related parts of your question here, so I’ll focus on reducing token usage with OpenAI models (including Codex-style coding use cases). The knowledge sources don’t cover Claude.
From the docs and forum posts, main ways to reduce tokens / make limits last longer are:
-
Generate fewer output tokens (biggest impact)
- Ask for brevity: e.g. “be very brief”, “under 20 words”, or specify a short format. [Generate fewer tokens]
- For structured output (JSON, tool calls), shorten field names and syntax. [Optimizing structured output]
- Use
max_tokens/ stop sequences to cap length. [Generate fewer tokens]
-
Use leaner prompts / fewer input tokens
- Remove repeated instructions and long examples; state each rule once. [Prompting best practices]
- Filter context (shorter RAG results, cleaned HTML, fewer files). [Use fewer input tokens]
- Truncate or summarize older conversation history instead of sending everything. [Realtime optimization]
-
Limit tools / functions and their descriptions
- Load only the tools needed for the current task and keep descriptions short, since tool definitions count as input tokens. [Token usage]
-
Change workflow to avoid unnecessary “chattiness”
- In coding agents, avoid huge, open‑ended tasks that cause repeated scans and edits; instead use small, bounded tasks per turn (the forum user calls this “mechanical coding”). [Forum: Codex usage]
- Replace some generative calls with cheaper operations like embeddings + vector search when you just need similarity / retrieval. [Minimizing token cost]
-
Use retrieval instead of giant prompts
- For large knowledge bases (laws, manuals, etc.), store them as embeddings and retrieve only the most relevant chunks instead of sending 90k‑token prompts. [Forum: reduce prompt tokens]
-
Model and service choices (for cost/limits)
- Use smaller / cheaper models for routine tasks where possible. [Cost optimization; Usage limits tips]
- For some workloads, use
service_tier=flexso you’re only charged for output tokens, which can cut costs for short extractions. [Minimizing token cost]
-
General cost-control practices
- Shorten or chunk inputs if you hit context limits. [Token limits]
- Cache repeated prompts/results so you don’t re-send the same large inputs. [Minimizing token cost]
- Monitor usage and adjust prompts/models once you see where tokens are going. [Managing costs]
The sources don’t provide specific guidance for Claude, only for OpenAI models.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@next pike Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Is it possible to create a model router for codex
@still glen is it possible to create a model router system for codex
Let me check the knowledge base for you again. One moment! :books:
Yes, you can build a model‑router–style setup around Codex, but the docs only describe this in terms of OpenAI models and tools, not Claude.
From the knowledge sources, there are two relevant patterns:
-
Multi‑model workflows with the Agents SDK
- You can define multiple agents, each with a different model (e.g., smaller model for triage, larger for complex work) and hand off between them in one workflow. [Mixing models; Agents models guide]
- This is effectively a router: one “triage” agent decides which specialist/model should handle the request.
-
Explicit routing logic in your own code
- The Cookbook’s model selection guide shows how to choose between models like
o4-mini,o3,gpt-4.1-mini, etc., based on task complexity, accuracy, and cost. [Model playbook] - You can implement similar logic around Codex: e.g., use a cheaper/faster model for broad analysis, then escalate to a stronger model for “heavy lifting,” as described in the Codex workflow forum answer (switching models between turns or across threads). [Codex multi‑model workflow]
- The Cookbook’s model selection guide shows how to choose between models like
However, the provided sources do not describe a dedicated, out‑of‑the‑box “model router” product specifically for Codex; they show general multi‑model routing patterns (Agents SDK, custom logic) that you can apply around Codex.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@next pike Kapa.ai is still learning and improving, please let me know how I did by reacting below.