Fix reasoning-models.ts example: Update model names and add error handling#79
Merged
saschabuehrle merged 3 commits intomainfrom Nov 20, 2025
Merged
Conversation
…r handling Changes: - Updated model names to actual OpenAI reasoning models (o1-mini, o1-preview) - Added try-catch blocks for graceful error handling when API access unavailable - Added clear notes about OpenAI API tier requirements (Tier 3+ for o1-mini, Tier 5 for o1-preview) - Updated cost estimates to match current OpenAI pricing - Fixed Example 4 scope issue by converting to skip message - Added try-catch to Claude example for resilient execution Why: - Example previously used non-existent model names (o4-mini, o3) - 403/404 errors confused users - now provides helpful guidance - Makes example runnable even without reasoning model access Fixes: reasoning-models.ts now runs successfully with exit code 0 Co-authored-by: Sascha Buehrle <sascha.buehrle@gmail.com>
Updated LangChain package documentation and examples to use correct API:
- COST_TRACKING.md: Replaced all `new CascadeFlow({` with `withCascade({`
- cost-tracking-providers.ts: Updated import and usage to use function API
Changes:
- Import: `import { CascadeFlow }` → `import { withCascade }`
- Usage: `new CascadeFlow({...})` → `withCascade({...})`
- Model names: Kept gpt-5-nano and gpt-5 as forward-looking examples
Testing: ✅ Verified with gpt-5 models (exit code 0)
Updated MODEL_PRICING_REFERENCE with correct OpenAI GPT-5 pricing: GPT-5.1: - Input: $2.00 → $1.25 per 1M tokens - Output: $15.00 → $10.00 per 1M tokens - Same pricing as GPT-5 GPT-5 series pricing (confirmed): - GPT-5.1: $1.25 input, $10.00 output - GPT-5: $1.25 input, $10.00 output - GPT-5-mini: $0.25 input, $2.00 output - GPT-5-nano: $0.05 input, $0.40 output All prices are non-batch API rates per 1M tokens. Updated comment from "estimated" to "official non-batch pricing".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the reasoning-models.ts example to use correct OpenAI reasoning model names and handle API access errors gracefully.
Changes
Before
After
Test Results
Why This Matters
Closes issue with reasoning-models.ts failing tests