Skip to content

feat: add user ID and adapter tags to AI Gateway requests#44

Merged
HugoRCD merged 2 commits into
mainfrom
feat/ai-gateway-advanced-reporting
Mar 27, 2026
Merged

feat: add user ID and adapter tags to AI Gateway requests#44
HugoRCD merged 2 commits into
mainfrom
feat/ai-gateway-advanced-reporting

Conversation

@bensabic
Copy link
Copy Markdown
Contributor

  • Extends the AI context (AsyncLocalStorage) in observe.ts to carry userId and tags alongside the existing model wrapper
  • Adds buildProviderOptions(model, metadata) and buildGatewayProviderOptions(metadata) to merge model fallbacks with gateway user/tags fields
  • Updates all agent prepareCall methods (base, source, admin) to send gateway metadata on every request
  • Updates standalone generateText calls (router, web search tools, title generation, OCR) to include gateway metadata
  • Web chat routes set userId to the authenticated user's ID with the web-chat tag
  • Bot adapter routes derive the tag from context.platform (e.g. github-adapter, discord-adapter) and send the message author's username as the user
  • Supports Vercel AI Gateway's new reporting API for per-user and per-adapter usage tracking

Sends gateway providerOptions (user, tags) on all AI SDK calls to support Vercel AI Gateway's new reporting API.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
knowledge-agent-template Ready Ready Preview, Comment Mar 24, 2026 11:40pm

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 24, 2026

Thank you for following the naming conventions! 🙏

@autofix-troubleshooter
Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@bensabic bensabic requested a review from HugoRCD March 24, 2026 23:33
@bensabic bensabic changed the title Add user ID and adapter tags to AI Gateway requests feat: add user ID and adapter tags to AI Gateway requests Mar 24, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 24, 2026

npm i https://pkg.pr.new/@savoir/sdk@44

commit: ed213eb

@HugoRCD HugoRCD merged commit fa7414d into main Mar 27, 2026
10 checks passed
@HugoRCD HugoRCD deleted the feat/ai-gateway-advanced-reporting branch March 27, 2026 23:18
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.

3 participants