// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as DatasetsAPI from './datasets'; import { DatasetCreateParams, DatasetCreateResponse, DatasetDeleteParams, DatasetDeleteResponse, DatasetGetParams, DatasetGetResponse, DatasetListParams, DatasetListResponse, DatasetListResponsesV4PagePaginationArray, DatasetUpdateParams, DatasetUpdateResponse, Datasets, } from './datasets'; import * as DynamicRoutingAPI from './dynamic-routing'; import { DynamicRouting, DynamicRoutingCreateDeploymentParams, DynamicRoutingCreateDeploymentResponse, DynamicRoutingCreateParams, DynamicRoutingCreateResponse, DynamicRoutingCreateVersionParams, DynamicRoutingCreateVersionResponse, DynamicRoutingDeleteParams, DynamicRoutingDeleteResponse, DynamicRoutingGetParams, DynamicRoutingGetResponse, DynamicRoutingGetVersionParams, DynamicRoutingGetVersionResponse, DynamicRoutingListDeploymentsParams, DynamicRoutingListDeploymentsResponse, DynamicRoutingListParams, DynamicRoutingListResponse, DynamicRoutingListVersionsParams, DynamicRoutingListVersionsResponse, DynamicRoutingUpdateParams, DynamicRoutingUpdateResponse, } from './dynamic-routing'; import * as EvaluationTypesAPI from './evaluation-types'; import { EvaluationTypeListParams, EvaluationTypeListResponse, EvaluationTypeListResponsesV4PagePaginationArray, EvaluationTypes, } from './evaluation-types'; import * as EvaluationsAPI from './evaluations'; import { EvaluationCreateParams, EvaluationCreateResponse, EvaluationDeleteParams, EvaluationDeleteResponse, EvaluationGetParams, EvaluationGetResponse, EvaluationListParams, EvaluationListResponse, EvaluationListResponsesV4PagePaginationArray, Evaluations, } from './evaluations'; import * as LogsAPI from './logs'; import { LogDeleteParams, LogDeleteResponse, LogEditParams, LogEditResponse, LogGetParams, LogGetResponse, LogListParams, LogListResponse, LogListResponsesV4PagePaginationArray, LogRequestParams, LogRequestResponse, LogResponseParams, LogResponseResponse, Logs, } from './logs'; import * as ProviderConfigsAPI from './provider-configs'; import { ProviderConfigCreateParams, ProviderConfigCreateResponse, ProviderConfigListParams, ProviderConfigListResponse, ProviderConfigListResponsesV4PagePaginationArray, ProviderConfigs, } from './provider-configs'; import * as URLsAPI from './urls'; import { URLGetParams, URLGetResponse, URLs } from './urls'; import * as BillingAPI from './billing/billing'; import { Billing, BillingCreditBalanceParams, BillingCreditBalanceResponse, BillingInvoiceHistoryParams, BillingInvoiceHistoryResponse, BillingInvoicePreviewParams, BillingInvoicePreviewResponse, BillingUsageHistoryParams, BillingUsageHistoryResponse, } from './billing/billing'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class AIGateway extends APIResource { evaluationTypes: EvaluationTypesAPI.EvaluationTypes = new EvaluationTypesAPI.EvaluationTypes(this._client); logs: LogsAPI.Logs = new LogsAPI.Logs(this._client); datasets: DatasetsAPI.Datasets = new DatasetsAPI.Datasets(this._client); evaluations: EvaluationsAPI.Evaluations = new EvaluationsAPI.Evaluations(this._client); dynamicRouting: DynamicRoutingAPI.DynamicRouting = new DynamicRoutingAPI.DynamicRouting(this._client); providerConfigs: ProviderConfigsAPI.ProviderConfigs = new ProviderConfigsAPI.ProviderConfigs(this._client); urls: URLsAPI.URLs = new URLsAPI.URLs(this._client); billing: BillingAPI.Billing = new BillingAPI.Billing(this._client); /** * Creates a new AI Gateway. * * @example * ```ts * const aiGateway = await client.aiGateway.create({ * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * id: 'my-gateway', * cache_invalidate_on_update: true, * cache_ttl: 0, * collect_logs: true, * rate_limiting_interval: 0, * rate_limiting_limit: 0, * }); * ``` */ create( params: AIGatewayCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/ai-gateway/gateways`, { body, ...options, }) as Core.APIPromise<{ result: AIGatewayCreateResponse }> )._thenUnwrap((obj) => obj.result); } /** * Updates an existing AI Gateway dataset. * * @example * ```ts * const aiGateway = await client.aiGateway.update( * 'my-gateway', * { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * cache_invalidate_on_update: true, * cache_ttl: 0, * collect_logs: true, * rate_limiting_interval: 0, * rate_limiting_limit: 0, * }, * ); * ``` */ update( id: string, params: AIGatewayUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/ai-gateway/gateways/${id}`, { body, ...options, }) as Core.APIPromise<{ result: AIGatewayUpdateResponse }> )._thenUnwrap((obj) => obj.result); } /** * Lists all AI Gateway evaluator types configured for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const aiGatewayListResponse of client.aiGateway.list( * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * )) { * // ... * } * ``` */ list( params: AIGatewayListParams, options?: Core.RequestOptions, ): Core.PagePromise { const { account_id, ...query } = params; return this._client.getAPIList( `/accounts/${account_id}/ai-gateway/gateways`, AIGatewayListResponsesV4PagePaginationArray, { query, ...options }, ); } /** * Deletes an AI Gateway dataset. * * @example * ```ts * const aiGateway = await client.aiGateway.delete( * 'my-gateway', * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * ); * ``` */ delete( id: string, params: AIGatewayDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; return ( this._client.delete(`/accounts/${account_id}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{ result: AIGatewayDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } /** * Retrieves details for a specific AI Gateway dataset. * * @example * ```ts * const aiGateway = await client.aiGateway.get('my-gateway', { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * }); * ``` */ get( id: string, params: AIGatewayGetParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/ai-gateway/gateways/${id}`, options) as Core.APIPromise<{ result: AIGatewayGetResponse; }> )._thenUnwrap((obj) => obj.result); } } export class AIGatewayListResponsesV4PagePaginationArray extends V4PagePaginationArray {} export interface AIGatewayCreateResponse { /** * gateway id */ id: string; cache_invalidate_on_update: boolean; cache_ttl: number | null; collect_logs: boolean; created_at: string; modified_at: string; rate_limiting_interval: number | null; rate_limiting_limit: number | null; authentication?: boolean; dlp?: AIGatewayCreateResponse.UnionMember0 | AIGatewayCreateResponse.UnionMember1; guardrails?: AIGatewayCreateResponse.Guardrails | null; is_default?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array | null; rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; store_id?: string | null; stripe?: AIGatewayCreateResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; zdr?: boolean; } export namespace AIGatewayCreateResponse { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayUpdateResponse { /** * gateway id */ id: string; cache_invalidate_on_update: boolean; cache_ttl: number | null; collect_logs: boolean; created_at: string; modified_at: string; rate_limiting_interval: number | null; rate_limiting_limit: number | null; authentication?: boolean; dlp?: AIGatewayUpdateResponse.UnionMember0 | AIGatewayUpdateResponse.UnionMember1; guardrails?: AIGatewayUpdateResponse.Guardrails | null; is_default?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array | null; rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; store_id?: string | null; stripe?: AIGatewayUpdateResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; zdr?: boolean; } export namespace AIGatewayUpdateResponse { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayListResponse { /** * gateway id */ id: string; cache_invalidate_on_update: boolean; cache_ttl: number | null; collect_logs: boolean; created_at: string; modified_at: string; rate_limiting_interval: number | null; rate_limiting_limit: number | null; authentication?: boolean; dlp?: AIGatewayListResponse.UnionMember0 | AIGatewayListResponse.UnionMember1; guardrails?: AIGatewayListResponse.Guardrails | null; is_default?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array | null; rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; store_id?: string | null; stripe?: AIGatewayListResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; zdr?: boolean; } export namespace AIGatewayListResponse { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayDeleteResponse { /** * gateway id */ id: string; cache_invalidate_on_update: boolean; cache_ttl: number | null; collect_logs: boolean; created_at: string; modified_at: string; rate_limiting_interval: number | null; rate_limiting_limit: number | null; authentication?: boolean; dlp?: AIGatewayDeleteResponse.UnionMember0 | AIGatewayDeleteResponse.UnionMember1; guardrails?: AIGatewayDeleteResponse.Guardrails | null; is_default?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array | null; rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; store_id?: string | null; stripe?: AIGatewayDeleteResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; zdr?: boolean; } export namespace AIGatewayDeleteResponse { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayGetResponse { /** * gateway id */ id: string; cache_invalidate_on_update: boolean; cache_ttl: number | null; collect_logs: boolean; created_at: string; modified_at: string; rate_limiting_interval: number | null; rate_limiting_limit: number | null; authentication?: boolean; dlp?: AIGatewayGetResponse.UnionMember0 | AIGatewayGetResponse.UnionMember1; guardrails?: AIGatewayGetResponse.Guardrails | null; is_default?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array | null; rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; store_id?: string | null; stripe?: AIGatewayGetResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; zdr?: boolean; } export namespace AIGatewayGetResponse { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayCreateParams { /** * Path param */ account_id: string; /** * Body param: gateway id */ id: string; /** * Body param */ cache_invalidate_on_update: boolean; /** * Body param */ cache_ttl: number | null; /** * Body param */ collect_logs: boolean; /** * Body param */ rate_limiting_interval: number | null; /** * Body param */ rate_limiting_limit: number | null; /** * Body param */ authentication?: boolean; /** * Body param */ log_management?: number | null; /** * Body param */ log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; /** * Body param */ logpush?: boolean; /** * Body param */ logpush_public_key?: string | null; /** * Body param */ rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Body param: Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Body param: Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Body param: Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; /** * Body param: Controls how Workers AI inference calls routed through this gateway * are billed. Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; /** * Body param */ zdr?: boolean; } export interface AIGatewayUpdateParams { /** * Path param */ account_id: string; /** * Body param */ cache_invalidate_on_update: boolean; /** * Body param */ cache_ttl: number | null; /** * Body param */ collect_logs: boolean; /** * Body param */ rate_limiting_interval: number | null; /** * Body param */ rate_limiting_limit: number | null; /** * Body param */ authentication?: boolean; /** * Body param */ dlp?: AIGatewayUpdateParams.UnionMember0 | AIGatewayUpdateParams.UnionMember1; /** * Body param */ guardrails?: AIGatewayUpdateParams.Guardrails | null; /** * Body param */ log_management?: number | null; /** * Body param */ log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; /** * Body param */ logpush?: boolean; /** * Body param */ logpush_public_key?: string | null; /** * Body param */ otel?: Array | null; /** * Body param */ rate_limiting_technique?: 'fixed' | 'sliding' | null; /** * Body param: Backoff strategy for retry delays */ retry_backoff?: 'constant' | 'linear' | 'exponential' | null; /** * Body param: Delay between retry attempts in milliseconds (0-5000) */ retry_delay?: number | null; /** * Body param: Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; /** * Body param */ store_id?: string | null; /** * Body param */ stripe?: AIGatewayUpdateParams.Stripe | null; /** * Body param: Controls how Workers AI inference calls routed through this gateway * are billed. Only 'postpaid' is currently supported. */ workers_ai_billing_mode?: 'postpaid'; /** * Body param */ zdr?: boolean; } export namespace AIGatewayUpdateParams { export interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array; } export interface UnionMember1 { enabled: boolean; policies: Array; } export namespace UnionMember1 { export interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array; } } export interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } export namespace Guardrails { export interface Prompt { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } export interface Response { P1?: 'FLAG' | 'BLOCK'; S1?: 'FLAG' | 'BLOCK'; S10?: 'FLAG' | 'BLOCK'; S11?: 'FLAG' | 'BLOCK'; S12?: 'FLAG' | 'BLOCK'; S13?: 'FLAG' | 'BLOCK'; S2?: 'FLAG' | 'BLOCK'; S3?: 'FLAG' | 'BLOCK'; S4?: 'FLAG' | 'BLOCK'; S5?: 'FLAG' | 'BLOCK'; S6?: 'FLAG' | 'BLOCK'; S7?: 'FLAG' | 'BLOCK'; S8?: 'FLAG' | 'BLOCK'; S9?: 'FLAG' | 'BLOCK'; } } export interface Otel { authorization: string; headers: { [key: string]: string }; url: string; content_type?: 'json' | 'protobuf'; } export interface Stripe { authorization: string; usage_events: Array; } export namespace Stripe { export interface UsageEvent { payload: string; } } } export interface AIGatewayListParams extends V4PagePaginationArrayParams { /** * Path param */ account_id: string; /** * Query param: Search by id */ search?: string; } export interface AIGatewayDeleteParams { account_id: string; } export interface AIGatewayGetParams { account_id: string; } AIGateway.AIGatewayListResponsesV4PagePaginationArray = AIGatewayListResponsesV4PagePaginationArray; AIGateway.EvaluationTypes = EvaluationTypes; AIGateway.EvaluationTypeListResponsesV4PagePaginationArray = EvaluationTypeListResponsesV4PagePaginationArray; AIGateway.Logs = Logs; AIGateway.LogListResponsesV4PagePaginationArray = LogListResponsesV4PagePaginationArray; AIGateway.Datasets = Datasets; AIGateway.DatasetListResponsesV4PagePaginationArray = DatasetListResponsesV4PagePaginationArray; AIGateway.Evaluations = Evaluations; AIGateway.EvaluationListResponsesV4PagePaginationArray = EvaluationListResponsesV4PagePaginationArray; AIGateway.DynamicRouting = DynamicRouting; AIGateway.ProviderConfigs = ProviderConfigs; AIGateway.ProviderConfigListResponsesV4PagePaginationArray = ProviderConfigListResponsesV4PagePaginationArray; AIGateway.URLs = URLs; AIGateway.Billing = Billing; export declare namespace AIGateway { export { type AIGatewayCreateResponse as AIGatewayCreateResponse, type AIGatewayUpdateResponse as AIGatewayUpdateResponse, type AIGatewayListResponse as AIGatewayListResponse, type AIGatewayDeleteResponse as AIGatewayDeleteResponse, type AIGatewayGetResponse as AIGatewayGetResponse, AIGatewayListResponsesV4PagePaginationArray as AIGatewayListResponsesV4PagePaginationArray, type AIGatewayCreateParams as AIGatewayCreateParams, type AIGatewayUpdateParams as AIGatewayUpdateParams, type AIGatewayListParams as AIGatewayListParams, type AIGatewayDeleteParams as AIGatewayDeleteParams, type AIGatewayGetParams as AIGatewayGetParams, }; export { EvaluationTypes as EvaluationTypes, type EvaluationTypeListResponse as EvaluationTypeListResponse, EvaluationTypeListResponsesV4PagePaginationArray as EvaluationTypeListResponsesV4PagePaginationArray, type EvaluationTypeListParams as EvaluationTypeListParams, }; export { Logs as Logs, type LogListResponse as LogListResponse, type LogDeleteResponse as LogDeleteResponse, type LogEditResponse as LogEditResponse, type LogGetResponse as LogGetResponse, type LogRequestResponse as LogRequestResponse, type LogResponseResponse as LogResponseResponse, LogListResponsesV4PagePaginationArray as LogListResponsesV4PagePaginationArray, type LogListParams as LogListParams, type LogDeleteParams as LogDeleteParams, type LogEditParams as LogEditParams, type LogGetParams as LogGetParams, type LogRequestParams as LogRequestParams, type LogResponseParams as LogResponseParams, }; export { Datasets as Datasets, type DatasetCreateResponse as DatasetCreateResponse, type DatasetUpdateResponse as DatasetUpdateResponse, type DatasetListResponse as DatasetListResponse, type DatasetDeleteResponse as DatasetDeleteResponse, type DatasetGetResponse as DatasetGetResponse, DatasetListResponsesV4PagePaginationArray as DatasetListResponsesV4PagePaginationArray, type DatasetCreateParams as DatasetCreateParams, type DatasetUpdateParams as DatasetUpdateParams, type DatasetListParams as DatasetListParams, type DatasetDeleteParams as DatasetDeleteParams, type DatasetGetParams as DatasetGetParams, }; export { Evaluations as Evaluations, type EvaluationCreateResponse as EvaluationCreateResponse, type EvaluationListResponse as EvaluationListResponse, type EvaluationDeleteResponse as EvaluationDeleteResponse, type EvaluationGetResponse as EvaluationGetResponse, EvaluationListResponsesV4PagePaginationArray as EvaluationListResponsesV4PagePaginationArray, type EvaluationCreateParams as EvaluationCreateParams, type EvaluationListParams as EvaluationListParams, type EvaluationDeleteParams as EvaluationDeleteParams, type EvaluationGetParams as EvaluationGetParams, }; export { DynamicRouting as DynamicRouting, type DynamicRoutingCreateResponse as DynamicRoutingCreateResponse, type DynamicRoutingUpdateResponse as DynamicRoutingUpdateResponse, type DynamicRoutingListResponse as DynamicRoutingListResponse, type DynamicRoutingDeleteResponse as DynamicRoutingDeleteResponse, type DynamicRoutingCreateDeploymentResponse as DynamicRoutingCreateDeploymentResponse, type DynamicRoutingCreateVersionResponse as DynamicRoutingCreateVersionResponse, type DynamicRoutingGetResponse as DynamicRoutingGetResponse, type DynamicRoutingGetVersionResponse as DynamicRoutingGetVersionResponse, type DynamicRoutingListDeploymentsResponse as DynamicRoutingListDeploymentsResponse, type DynamicRoutingListVersionsResponse as DynamicRoutingListVersionsResponse, type DynamicRoutingCreateParams as DynamicRoutingCreateParams, type DynamicRoutingUpdateParams as DynamicRoutingUpdateParams, type DynamicRoutingListParams as DynamicRoutingListParams, type DynamicRoutingDeleteParams as DynamicRoutingDeleteParams, type DynamicRoutingCreateDeploymentParams as DynamicRoutingCreateDeploymentParams, type DynamicRoutingCreateVersionParams as DynamicRoutingCreateVersionParams, type DynamicRoutingGetParams as DynamicRoutingGetParams, type DynamicRoutingGetVersionParams as DynamicRoutingGetVersionParams, type DynamicRoutingListDeploymentsParams as DynamicRoutingListDeploymentsParams, type DynamicRoutingListVersionsParams as DynamicRoutingListVersionsParams, }; export { ProviderConfigs as ProviderConfigs, type ProviderConfigCreateResponse as ProviderConfigCreateResponse, type ProviderConfigListResponse as ProviderConfigListResponse, ProviderConfigListResponsesV4PagePaginationArray as ProviderConfigListResponsesV4PagePaginationArray, type ProviderConfigCreateParams as ProviderConfigCreateParams, type ProviderConfigListParams as ProviderConfigListParams, }; export { URLs as URLs, type URLGetResponse as URLGetResponse, type URLGetParams as URLGetParams }; export { Billing as Billing, type BillingCreditBalanceResponse as BillingCreditBalanceResponse, type BillingInvoiceHistoryResponse as BillingInvoiceHistoryResponse, type BillingInvoicePreviewResponse as BillingInvoicePreviewResponse, type BillingUsageHistoryResponse as BillingUsageHistoryResponse, type BillingCreditBalanceParams as BillingCreditBalanceParams, type BillingInvoiceHistoryParams as BillingInvoiceHistoryParams, type BillingInvoicePreviewParams as BillingInvoicePreviewParams, type BillingUsageHistoryParams as BillingUsageHistoryParams, }; }