Skip to content

fix: compound User-Agent so provider traffic is attributable in SDK telemetry - #3

Merged
vrishab-jpg merged 1 commit into
masterfrom
fix/compound-user-agent
Jul 7, 2026
Merged

fix: compound User-Agent so provider traffic is attributable in SDK telemetry#3
vrishab-jpg merged 1 commit into
masterfrom
fix/compound-user-agent

Conversation

@vrishab-jpg

Copy link
Copy Markdown
Collaborator

Why

The API now classifies every request's integration (official Python/TS SDK, raw HTTP, OpenAI/Anthropic-compatible). Header dump showed this provider's traffic went out with user-agent: ai-sdk/speechify/0.2.0 — our suffix replaced the @speechify/api client's own User-Agent (Fern's mergeHeaders lets constructor headers override defaults). Depending on what the classifier keys on, provider traffic would read as either plain TS SDK (via the surviving x-fern-sdk-name) or unknown — never as the Vercel provider.

What

Append the marker at the fetch layer instead of the header option. Outgoing UA is now:

@speechify/api/1.0.2 ai-sdk/speechify/0.2.0

(x-fern-* headers untouched; 1.0.2 is the published SDK's own version-drift bug, fixed upstream in the next @speechify/api release.)

  • Wrapper composes with a user-supplied custom fetch
  • Idempotent (won't double-append)
  • Test pins the compound shape with a regex

Telemetry follow-up (Kai)

To surface this as its own integration bucket, classify UA containing ai-sdk/speechify/ as Vercel AI SDK provider (it will otherwise fall into the TS SDK bucket, which is a correct-but-less-useful baseline since we ride on @speechify/api).

Passing the suffix as a client header replaced @speechify/api's own
User-Agent, making provider traffic unattributable in API-side SDK
telemetry (it read as neither the TS SDK nor a distinct integration).
The suffix is now appended at the fetch layer, producing e.g.
"@speechify/api/2.0.0 ai-sdk/speechify/0.2.0".
@vrishab-jpg
vrishab-jpg merged commit c9d1659 into master Jul 7, 2026
4 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