fix: Make OpenRouterUsage fields optional to handle incomplete API re…#15
Merged
christopherkarani merged 1 commit intochristopherkarani:mainfrom Jan 8, 2026
Conversation
…sponses Some OpenRouter API responses don't include complete usage data (missing fields or null values), which caused JSON decoding failures. This change: - Makes promptTokens, completionTokens, and totalTokens optional in OpenRouterUsage - Updates OpenRouterProvider to safely unwrap usage values before creating TokenUsage - Adds comprehensive unit tests for OpenRouter type decoding (14 tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
|
@claude review this pr |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Owner
|
@iliasaz I review this pr. and currently holding off on it as we're planning to use https://github.com/christopherkarani/Conduit as the main inference layer. what are your thoughts? |
Contributor
Author
|
Is Conduit the next iteration of your SwiftAI project, or is it something radically new? |
701adea
into
christopherkarani:main
0 of 4 checks passed
christopherkarani
added a commit
that referenced
this pull request
Feb 13, 2026
…licate detection - Issue #3: Replace .rawValue == string comparisons with typed constants for HiveChatRole (system, tool, assistant) - Issue #6: Add error logging in router catch block when failing to read pendingToolCallsKey - Issue #7: Add duplicateToolName error case and guard in init to throw instead of silently overwriting tools with duplicate names - Issue #15: Add preconditions to HiveCompactionPolicy.init to validate maxTokens >= 1 and preserveLastMessages >= 0
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.
Some OpenRouter API responses don't include complete usage data (missing fields or null values), which caused JSON decoding failures. This change: