Add first-class UsageTap gateway provider (usagetapAdapter) - #21
Merged
PredictabilityAtScale merged 1 commit intoJul 27, 2026
Merged
Conversation
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.
Motivation
usagetapmodeled after the existing LLMAsAService adapter so prompt assets can target the first-party UsageTap gateway without changingllmasaservicebehavior.usagetapas a first-class, provider-scoped option.OpenAIclient pointing at the gateway with runtime credentials that are never serialized into prompt artifacts.Description
usagetapAdapterand SDK helpercreateUsageTapGatewayOpenAIConfigplus constantsUSAGETAP_GATEWAY_BASE_URL,USAGETAP_GATEWAY_DEFAULT_MODEL, andUSAGETAP_GATEWAY_RESPONSE_HEADER_NAMES, and exported the new symbols from the package root andpromptopskit/usagetap.UsageTapGatewayRuntimeOptions(runtimeapiKeyand optionalidempotencyKey) and addedUsageTapGatewayOpenAIConfig/UsageTapGatewayOpenAIConfigOptionstypes.provider_options.usagetap, optional richcustomerattribution, andprovider_options.usagetap.compress(andraw.usagetappassthrough), and wired these into defaults/override merging and raw merging logic.usagetap/standard, GPT-5max_tokens→max_completion_tokenscompatibility, orderedfallback_models→modelsmapping (avoid duplicating primary), injection of customer/feature/conversation/project/compress fields, raw-last override semantics, and runtime-onlyIdempotency-Keyheader emission.Testing
npm run lint(tsc --noEmit) completed with no errors.npm test(vitest run) and all tests passed: 15 test files, 275 tests passed.npm run build(tsup) which completed successfully and produced ESM/CJS and DTS artifacts for the newusagetapentries.npm run attw(node scripts/check-attw.mjs) and it reported "No problems found" for all entries including the newusagetapoutputs.Public API added:
USAGETAP_GATEWAY_BASE_URL,USAGETAP_GATEWAY_DEFAULT_MODEL,USAGETAP_GATEWAY_RESPONSE_HEADER_NAMES,UsageTapGatewayRuntimeOptions,UsageTapGatewayOpenAIConfig,UsageTapGatewayOpenAIConfigOptions,createUsageTapGatewayOpenAIConfig, andusagetapAdapter.Compatibility decisions:
usagetapis a separate provider and does not replace or alterllmasaservice; UsageTap lifecycle/mediation helpers remain available but must not be used to wrap gateway calls (to avoid double-metering).Codex Task