Skip to content

fix: add metadata.user_id to Anthropic API requests#8138

Closed
GangWangAI wants to merge 3 commits intoanomalyco:devfrom
GangWangAI:fix/anthropic-metadata-user-id
Closed

fix: add metadata.user_id to Anthropic API requests#8138
GangWangAI wants to merge 3 commits intoanomalyco:devfrom
GangWangAI:fix/anthropic-metadata-user-id

Conversation

@GangWangAI
Copy link

Summary

  • Add metadata.user_id field to Anthropic API requests to enable proper caching
  • The user_id format: user_{projectId}_account__session_{sessionId}

Changes

  • provider.ts: Add custom fetch to inject metadata into request body
  • llm.ts: Add x-opencode-session header (removed before sending to API)

fwang and others added 3 commits January 12, 2026 22:07
Add metadata.user_id field to Anthropic API requests to enable proper
caching. The user_id is constructed from project ID and session ID in
the format: user_{projectId}_account__session_{sessionId}
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments