Fix: Improve Claude API error handling with OpenAI fallback#28
Open
swinney wants to merge 2 commits into
Open
Conversation
- Add create_file_url() and format_output_summary() utility functions - Update all CLI output to show clickable file:// URLs for generated files - Enhanced output format shows output directory followed by individual files - Works with both legacy flag-based CLI and new command pattern - Each file path is fully qualified and clickable in supported terminals Output format: 📁 Output directory: file:///path/to/output/ 📄 Generated: file:///path/to/output/document_v1.md 📄 Generated: file:///path/to/output/document_v2.md ⭐ Best compilation: file:///path/to/output/document_best.md Updated functions: - run_generation() - Legacy topic mode - run_readme_generation() - Legacy README mode - run_standardization() - Legacy standardization mode - GenerateCommand.run() - New command pattern - ReadmeCommand._display_results() - New command pattern - StandardizeCommand._display_results() - New command pattern This improves UX by making generated files easily accessible via click-to-open functionality in modern terminals.
- Enhanced error messages for insufficient Claude API credits - Added automatic fallback to OpenAI when Claude credits are low - Improved user feedback with clear instructions for resolving credit issues - Tested fallback mechanism successfully switches to gpt-4o-mini - Maintains normal operation for both providers when credits are available This fix ensures documentation generation continues even when Claude API credits are exhausted by automatically switching to OpenAI as a fallback.
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
Problem
The recent model updates exposed an issue where insufficient Claude API credits would cause all documentation generation to fail with cryptic error messages, even though OpenAI was available as an alternative provider.
Solution
ClaudeProviderto detect credit-related errors specifically and provide helpful error messages with links to billing pageTesting
Example Output
This ensures users can continue working even when one provider has issues.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com