fix: compound User-Agent so provider traffic is attributable in SDK telemetry - #3
Merged
Merged
Conversation
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/apiclient's own User-Agent (Fern'smergeHeaderslets constructor headers override defaults). Depending on what the classifier keys on, provider traffic would read as either plain TS SDK (via the survivingx-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:
(x-fern-* headers untouched;
1.0.2is the published SDK's own version-drift bug, fixed upstream in the next@speechify/apirelease.)fetchTelemetry 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).