feat: Update response handling and logging for improved usage tracking

This commit is contained in:
decolua
2026-02-03 10:22:43 +07:00
parent a33924b336
commit df0e1d6485
7 changed files with 348 additions and 152 deletions

View File

@@ -192,7 +192,10 @@ export function openaiToClaudeResponse(chunk, state) {
});
}
// Use tracked usage or default to 0
// Mark finish for later usage injection in stream.js
state.finishReason = choice.finish_reason;
// Use tracked usage (will be estimated in stream.js if not valid)
const finalUsage = state.usage || { input_tokens: 0, output_tokens: 0 };
results.push({
type: "message_delta",