Skip to main content

Class: AIGatewayModelPricingClient

Defined in: src/ai-gateway/model-pricing-client.ts:56

Unauthenticated public model-pricing catalog, isolated from SCM and gateway runtime clients. Prices are upstream catalog data, not effective tenant billing or Prisma cost telemetry. No formula evaluation, price conversion, caching, default provider or model is performed.

Example​

const pricing = new AIGatewayModelPricingClient({ endpoint: 'https://api.portkey.ai' });
const config = await pricing.get('openai', 'text-embedding-3-small');
console.log(config.currency, config.pay_as_you_go?.request_token?.price); // cents/token

Constructors​

Constructor​

new AIGatewayModelPricingClient(options): AIGatewayModelPricingClient;

Defined in: src/ai-gateway/model-pricing-client.ts:60

Parameters​

ParameterType
optionsAIGatewayModelPricingClientOptions

Returns​

AIGatewayModelPricingClient

Methods​

get()​

get(
provider,
model,
options?): Promise<objectOutputType<{
pay_as_you_go: ZodOptional<ZodObject<{
request_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
response_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
cache_write_input_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
cache_read_input_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
request_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
response_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
cache_read_audio_input_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>>;
image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<{
price: ...;
}, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
request_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
response_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_write_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_read_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
request_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
response_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_read_audio_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{
price: ...;
}, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>;
image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<..., ..., ..., ..., ...>>>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
request_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
response_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_write_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_read_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
request_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
response_audio_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
cache_read_audio_input_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{
price: ...;
}, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>;
image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<..., ..., ..., ..., ...>>>>;
}, ZodTypeAny, "passthrough">>>;
calculate: ZodOptional<ZodObject<{
request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>;
}, ZodTypeAny, "passthrough">>>;
currency: ZodOptional<ZodLiteral<"USD">>;
finetune_config: ZodOptional<ZodObject<{
pay_per_token: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
pay_per_hour: ZodOptional<ZodObject<{
price: ZodOptional<ZodNumber>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ZodOptional<...>;
}, ZodTypeAny, "passthrough">>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
pay_per_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
pay_per_hour: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
pay_per_token: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
pay_per_hour: ZodOptional<ZodObject<{
price: ZodOptional<...>;
}, "passthrough", ZodTypeAny, objectOutputType<{
price: ...;
}, ZodTypeAny, "passthrough">, objectInputType<{
price: ...;
}, ZodTypeAny, "passthrough">>>;
}, ZodTypeAny, "passthrough">>>;
}, ZodTypeAny, "passthrough">>;

Defined in: src/ai-gateway/model-pricing-client.ts:96

Read one provider/model's public catalog rates and unevaluated calculation expressions.

Parameters​

ParameterType
providerstring
modelstring
optionsGatewayModelPricingRequestOptions

Returns​

Promise<objectOutputType<{ pay_as_you_go: ZodOptional<ZodObject<{ request_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; response_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; cache_write_input_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; cache_read_input_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; request_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; response_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; cache_read_audio_input_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>>; image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<{ price: ...; }, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>>; }, "passthrough", ZodTypeAny, objectOutputType<{ request_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; response_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_write_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_read_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; request_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; response_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_read_audio_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{ price: ...; }, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>; image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<..., ..., ..., ..., ...>>>>; }, ZodTypeAny, "passthrough">, objectInputType<{ request_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; response_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_write_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_read_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; request_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; response_audio_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; cache_read_audio_input_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; additional_units: ZodOptional<ZodRecord<ZodString, ZodObject<{ price: ...; }, "passthrough", ZodTypeAny, objectOutputType<..., ..., ...>, objectInputType<..., ..., ...>>>>; image: ZodOptional<ZodRecord<ZodString, ZodRecord<ZodString, ZodObject<..., ..., ..., ..., ...>>>>; }, ZodTypeAny, "passthrough">>>; calculate: ZodOptional<ZodObject<{ request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; }, "passthrough", ZodTypeAny, objectOutputType<{ request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; }, ZodTypeAny, "passthrough">, objectInputType<{ request: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; response: ZodOptional<ZodType<GatewayModelPricingCalculation, ZodTypeDef, GatewayModelPricingCalculation>>; }, ZodTypeAny, "passthrough">>>; currency: ZodOptional<ZodLiteral<"USD">>; finetune_config: ZodOptional<ZodObject<{ pay_per_token: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; pay_per_hour: ZodOptional<ZodObject<{ price: ZodOptional<ZodNumber>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ZodOptional<...>; }, ZodTypeAny, "passthrough">>>; }, "passthrough", ZodTypeAny, objectOutputType<{ pay_per_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; pay_per_hour: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; }, ZodTypeAny, "passthrough">, objectInputType<{ pay_per_token: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; pay_per_hour: ZodOptional<ZodObject<{ price: ZodOptional<...>; }, "passthrough", ZodTypeAny, objectOutputType<{ price: ...; }, ZodTypeAny, "passthrough">, objectInputType<{ price: ...; }, ZodTypeAny, "passthrough">>>; }, ZodTypeAny, "passthrough">>>; }, ZodTypeAny, "passthrough">>

Example​

`await pricing.get('openai', 'gpt-5.6-terra', { signal: controller.signal });`