Skip to content

fix(antigravity): strip billing header from system instruction before upstream call#2817

Merged
luispater merged 1 commit intorouter-for-me:devfrom
sususu98:fix/antigravity-strip-billing-header
Apr 15, 2026
Merged

fix(antigravity): strip billing header from system instruction before upstream call#2817
luispater merged 1 commit intorouter-for-me:devfrom
sususu98:fix/antigravity-strip-billing-header

Conversation

@sususu98
Copy link
Copy Markdown
Collaborator

Summary

  • Strip x-anthropic-billing-header block from the Claude system array before forwarding to Gemini upstream
  • This block is client-internal metadata and should not be included in systemInstruction.parts

Test plan

  • Verify requests with billing header in system instruction no longer forward it upstream
  • Verify normal system instructions are unaffected

… upstream call

The x-anthropic-billing-header block in the Claude system array is
client-internal metadata and should not be forwarded to the Gemini
upstream as part of systemInstruction.parts.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a filter to skip system prompts starting with 'x-anthropic-billing-header:' during Claude request translation. The review feedback suggests improving the robustness of this check by normalizing the input string (trimming whitespace and lowercasing) and applying the same logic to other request formats for consistency.

Comment on lines +104 to +106
if strings.HasPrefix(systemPrompt, "x-anthropic-billing-header:") {
continue
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check for the billing header is case-sensitive and does not account for potential leading or trailing whitespace. Normalizing the string before checking the prefix makes the stripping more robust. Additionally, this logic should also be applied to the case where the system instruction is a single string (lines 115-119) to ensure consistent behavior across different request formats.

Suggested change
if strings.HasPrefix(systemPrompt, "x-anthropic-billing-header:") {
continue
}
if strings.HasPrefix(strings.ToLower(strings.TrimSpace(systemPrompt)), "x-anthropic-billing-header:") {
continue
}

@luispater luispater merged commit ba454db into router-for-me:dev Apr 15, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants