UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

1,395 lines • 50 kB
import { APIResource } from "../../core/resource.js"; import * as CustomProvidersAPI from "./custom-providers.js"; import { BaseCustomProviders, CustomProviderCreateParams, CustomProviderCreateResponse, CustomProviderDeleteParams, CustomProviderDeleteResponse, CustomProviderGetParams, CustomProviderGetResponse, CustomProviderListParams, CustomProviderListResponse, CustomProviderListResponsesV4PagePaginationArray, CustomProviders } from "./custom-providers.js"; import * as DatasetsAPI from "./datasets.js"; import { BaseDatasets, DatasetCreateParams, DatasetCreateResponse, DatasetDeleteParams, DatasetDeleteResponse, DatasetGetParams, DatasetGetResponse, DatasetListParams, DatasetListResponse, DatasetListResponsesV4PagePaginationArray, DatasetUpdateParams, DatasetUpdateResponse, Datasets } from "./datasets.js"; import * as DynamicRoutingAPI from "./dynamic-routing.js"; import { BaseDynamicRouting, DynamicRouting, DynamicRoutingCreateDeploymentParams, DynamicRoutingCreateDeploymentResponse, DynamicRoutingCreateParams, DynamicRoutingCreateResponse, DynamicRoutingCreateVersionParams, DynamicRoutingCreateVersionResponse, DynamicRoutingDeleteParams, DynamicRoutingDeleteResponse, DynamicRoutingGetParams, DynamicRoutingGetResponse, DynamicRoutingGetVersionParams, DynamicRoutingGetVersionResponse, DynamicRoutingListDeploymentsParams, DynamicRoutingListDeploymentsResponse, DynamicRoutingListParams, DynamicRoutingListResponse, DynamicRoutingListVersionsParams, DynamicRoutingListVersionsResponse, DynamicRoutingUpdateParams, DynamicRoutingUpdateResponse } from "./dynamic-routing.js"; import * as EvaluationTypesAPI from "./evaluation-types.js"; import { BaseEvaluationTypes, EvaluationTypeListParams, EvaluationTypeListResponse, EvaluationTypeListResponsesV4PagePaginationArray, EvaluationTypes } from "./evaluation-types.js"; import * as EvaluationsAPI from "./evaluations.js"; import { BaseEvaluations, EvaluationCreateParams, EvaluationCreateResponse, EvaluationDeleteParams, EvaluationDeleteResponse, EvaluationGetParams, EvaluationGetResponse, EvaluationListParams, EvaluationListResponse, EvaluationListResponsesV4PagePaginationArray, Evaluations } from "./evaluations.js"; import * as LogsAPI from "./logs.js"; import { BaseLogs, LogDeleteParams, LogDeleteResponse, LogEditParams, LogEditResponse, LogGetParams, LogGetResponse, LogListParams, LogListResponse, LogListResponsesV4PagePaginationArray, LogRequestParams, LogRequestResponse, LogResponseParams, LogResponseResponse, Logs } from "./logs.js"; import * as ProviderConfigsAPI from "./provider-configs.js"; import { BaseProviderConfigs, ProviderConfigCreateParams, ProviderConfigCreateResponse, ProviderConfigListParams, ProviderConfigListResponse, ProviderConfigListResponsesV4PagePaginationArray, ProviderConfigs } from "./provider-configs.js"; import * as URLsAPI from "./urls.js"; import { BaseURLs, URLGetParams, URLGetResponse, URLs } from "./urls.js"; import * as BillingAPI from "./billing/billing.js"; import { BaseBilling, Billing, BillingCreditBalanceParams, BillingCreditBalanceResponse, BillingInvoiceHistoryParams, BillingInvoiceHistoryResponse, BillingInvoicePreviewParams, BillingInvoicePreviewResponse, BillingUsageHistoryParams, BillingUsageHistoryResponse } from "./billing/billing.js"; import { APIPromise } from "../../core/api-promise.js"; import { PagePromise, V4PagePaginationArray, type V4PagePaginationArrayParams } from "../../core/pagination.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class BaseAIGateway extends APIResource { static readonly _key: readonly ['aiGateway']; /** * Creates an AI Gateway in the account with the specified caching, rate limiting, * logging, and authentication settings. The gateway ID appears in request URLs and * must be unique within the account. * * @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?: RequestOptions): APIPromise<AIGatewayCreateResponse>; /** * Updates the configuration of an AI Gateway, such as its caching, rate limiting, * logging, and authentication settings. * * @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?: RequestOptions): APIPromise<AIGatewayUpdateResponse>; /** * Lists the AI Gateways in the account. Use `search` to filter by gateway ID. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const aiGatewayListResponse of client.aiGateway.list( * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * )) { * // ... * } * ``` */ list(params: AIGatewayListParams, options?: RequestOptions): PagePromise<AIGatewayListResponsesV4PagePaginationArray, AIGatewayListResponse>; /** * Permanently deletes an AI Gateway, its configuration, and its stored logs. * * @example * ```ts * const aiGateway = await client.aiGateway.delete( * 'my-gateway', * { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' }, * ); * ``` */ delete(id: string, params: AIGatewayDeleteParams, options?: RequestOptions): APIPromise<AIGatewayDeleteResponse>; /** * Retrieves the configuration of an AI Gateway. * * @example * ```ts * const aiGateway = await client.aiGateway.get('my-gateway', { * account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0', * }); * ``` */ get(id: string, params: AIGatewayGetParams, options?: RequestOptions): APIPromise<AIGatewayGetResponse>; } export declare class AIGateway extends BaseAIGateway { evaluationTypes: EvaluationTypesAPI.EvaluationTypes; customProviders: CustomProvidersAPI.CustomProviders; logs: LogsAPI.Logs; datasets: DatasetsAPI.Datasets; evaluations: EvaluationsAPI.Evaluations; dynamicRouting: DynamicRoutingAPI.DynamicRouting; providerConfigs: ProviderConfigsAPI.ProviderConfigs; urls: URLsAPI.URLs; billing: BillingAPI.Billing; } export type AIGatewayListResponsesV4PagePaginationArray = V4PagePaginationArray<AIGatewayListResponse>; export interface AIGatewayCreateResponse { /** * Unique identifier of the AI Gateway within the account. */ 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; /** * Requires customer-provided provider credentials and prevents fallback to Unified * Billing. */ byok_only?: boolean; dlp?: AIGatewayCreateResponse.UnionMember0 | AIGatewayCreateResponse.UnionMember1; guardrails?: AIGatewayCreateResponse.Guardrails | null; is_default?: boolean; log_classification?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array<AIGatewayCreateResponse.Otel> | 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-60000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; spend_limits?: AIGatewayCreateResponse.SpendLimits | null; store_id?: string | null; stripe?: AIGatewayCreateResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * 'postpaid' bills the account directly through Workers AI; 'unified' deducts * credits via AI Gateway using neuron-based pricing and delegates billing to AI * Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; zdr?: boolean; } export declare namespace AIGatewayCreateResponse { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } export interface AIGatewayUpdateResponse { /** * Unique identifier of the AI Gateway within the account. */ 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; /** * Requires customer-provided provider credentials and prevents fallback to Unified * Billing. */ byok_only?: boolean; dlp?: AIGatewayUpdateResponse.UnionMember0 | AIGatewayUpdateResponse.UnionMember1; guardrails?: AIGatewayUpdateResponse.Guardrails | null; is_default?: boolean; log_classification?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array<AIGatewayUpdateResponse.Otel> | 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-60000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; spend_limits?: AIGatewayUpdateResponse.SpendLimits | null; store_id?: string | null; stripe?: AIGatewayUpdateResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * 'postpaid' bills the account directly through Workers AI; 'unified' deducts * credits via AI Gateway using neuron-based pricing and delegates billing to AI * Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; zdr?: boolean; } export declare namespace AIGatewayUpdateResponse { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } export interface AIGatewayListResponse { /** * Unique identifier of the AI Gateway within the account. */ 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; /** * Requires customer-provided provider credentials and prevents fallback to Unified * Billing. */ byok_only?: boolean; dlp?: AIGatewayListResponse.UnionMember0 | AIGatewayListResponse.UnionMember1; guardrails?: AIGatewayListResponse.Guardrails | null; is_default?: boolean; log_classification?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array<AIGatewayListResponse.Otel> | 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-60000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; spend_limits?: AIGatewayListResponse.SpendLimits | null; store_id?: string | null; stripe?: AIGatewayListResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * 'postpaid' bills the account directly through Workers AI; 'unified' deducts * credits via AI Gateway using neuron-based pricing and delegates billing to AI * Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; zdr?: boolean; } export declare namespace AIGatewayListResponse { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } export interface AIGatewayDeleteResponse { /** * Unique identifier of the AI Gateway within the account. */ 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; /** * Requires customer-provided provider credentials and prevents fallback to Unified * Billing. */ byok_only?: boolean; dlp?: AIGatewayDeleteResponse.UnionMember0 | AIGatewayDeleteResponse.UnionMember1; guardrails?: AIGatewayDeleteResponse.Guardrails | null; is_default?: boolean; log_classification?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array<AIGatewayDeleteResponse.Otel> | 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-60000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; spend_limits?: AIGatewayDeleteResponse.SpendLimits | null; store_id?: string | null; stripe?: AIGatewayDeleteResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * 'postpaid' bills the account directly through Workers AI; 'unified' deducts * credits via AI Gateway using neuron-based pricing and delegates billing to AI * Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; zdr?: boolean; } export declare namespace AIGatewayDeleteResponse { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } export interface AIGatewayGetResponse { /** * Unique identifier of the AI Gateway within the account. */ 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; /** * Requires customer-provided provider credentials and prevents fallback to Unified * Billing. */ byok_only?: boolean; dlp?: AIGatewayGetResponse.UnionMember0 | AIGatewayGetResponse.UnionMember1; guardrails?: AIGatewayGetResponse.Guardrails | null; is_default?: boolean; log_classification?: boolean; log_management?: number | null; log_management_strategy?: 'STOP_INSERTING' | 'DELETE_OLDEST' | null; logpush?: boolean; logpush_public_key?: string | null; otel?: Array<AIGatewayGetResponse.Otel> | 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-60000) */ retry_delay?: number | null; /** * Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; spend_limits?: AIGatewayGetResponse.SpendLimits | null; store_id?: string | null; stripe?: AIGatewayGetResponse.Stripe | null; /** * Controls how Workers AI inference calls routed through this gateway are billed. * 'postpaid' bills the account directly through Workers AI; 'unified' deducts * credits via AI Gateway using neuron-based pricing and delegates billing to AI * Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; zdr?: boolean; } export declare namespace AIGatewayGetResponse { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } export interface AIGatewayCreateParams { /** * Path param */ account_id: string; /** * Body param: Unique identifier of the AI Gateway within the 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: Requires customer-provided provider credentials and prevents * fallback to Unified Billing. */ byok_only?: boolean; /** * Body param */ dlp?: AIGatewayCreateParams.UnionMember0 | AIGatewayCreateParams.UnionMember1; /** * Body param */ guardrails?: AIGatewayCreateParams.Guardrails | null; /** * Body param */ log_classification?: 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 */ otel?: Array<AIGatewayCreateParams.Otel> | 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-60000) */ retry_delay?: number | null; /** * Body param: Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; /** * Body param */ spend_limits?: AIGatewayCreateParams.SpendLimits | null; /** * Body param */ store_id?: string | null; /** * Body param */ stripe?: AIGatewayCreateParams.Stripe | null; /** * Body param: Controls how Workers AI inference calls routed through this gateway * are billed. 'postpaid' bills the account directly through Workers AI; 'unified' * deducts credits via AI Gateway using neuron-based pricing and delegates billing * to AI Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; /** * Body param */ zdr?: boolean; } export declare namespace AIGatewayCreateParams { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { interface UsageEvent { payload: string; } } } 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: Requires customer-provided provider credentials and prevents * fallback to Unified Billing. */ byok_only?: boolean; /** * Body param */ dlp?: AIGatewayUpdateParams.UnionMember0 | AIGatewayUpdateParams.UnionMember1; /** * Body param */ guardrails?: AIGatewayUpdateParams.Guardrails | null; /** * Body param */ log_classification?: 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 */ otel?: Array<AIGatewayUpdateParams.Otel> | 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-60000) */ retry_delay?: number | null; /** * Body param: Maximum number of retry attempts for failed requests (1-5) */ retry_max_attempts?: number | null; /** * Body param */ spend_limits?: AIGatewayUpdateParams.SpendLimits | 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. 'postpaid' bills the account directly through Workers AI; 'unified' * deducts credits via AI Gateway using neuron-based pricing and delegates billing * to AI Gateway. */ workers_ai_billing_mode?: 'postpaid' | 'unified'; /** * Body param */ zdr?: boolean; } export declare namespace AIGatewayUpdateParams { interface UnionMember0 { action: 'BLOCK' | 'FLAG'; enabled: boolean; profiles: Array<string>; } interface UnionMember1 { enabled: boolean; policies: Array<UnionMember1.Policy>; } namespace UnionMember1 { interface Policy { id: string; action: 'FLAG' | 'BLOCK'; check: Array<'REQUEST' | 'RESPONSE'>; enabled: boolean; profiles: Array<string>; } } interface Guardrails { prompt: Guardrails.Prompt; response: Guardrails.Response; } namespace Guardrails { 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'; } 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'; } } interface Otel { headers: { [key: string]: string; }; url: string; authorization?: string; content_type?: 'json' | 'protobuf'; } interface SpendLimits { enabled?: boolean; rules?: Array<SpendLimits.Rule>; } namespace SpendLimits { interface Rule { limit: number; limitType: 'cost'; window: number; id?: string; enabled?: boolean; metadata?: { [key: string]: Rule.Mode | Rule.UnionMember1; }; model?: Rule.Model; provider?: Rule.Provider; technique?: 'fixed' | 'sliding'; } namespace Rule { interface Mode { mode: 'partition'; } interface UnionMember1 { mode: 'filter'; values: Array<string>; } interface Model { mode: 'filter'; values: Array<string>; } interface Provider { mode: 'filter'; values: Array<string>; } } } interface Stripe { authorization: string; usage_events: Array<Stripe.UsageEvent>; } namespace Stripe { 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; } 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, type 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, BaseEvaluationTypes as BaseEvaluationTypes, type EvaluationTypeListResponse as EvaluationTypeListResponse, type EvaluationTypeListResponsesV4PagePaginationArray as EvaluationTypeListResponsesV4PagePaginationArray, type EvaluationTypeListParams as EvaluationTypeListParams, }; export { CustomProviders as CustomProviders, BaseCustomProviders as BaseCustomProviders, type CustomProviderCreateResponse as CustomProviderCreateResponse, type CustomProviderListResponse as CustomProviderListResponse, type CustomProviderDeleteResponse as CustomProviderDeleteResponse, type CustomProviderGetResponse as CustomProviderGetResponse, type CustomProviderListResponsesV4PagePaginationArray as CustomProviderListResponsesV4PagePaginationArray, type CustomProviderCreateParams as CustomProviderCreateParams, type CustomProviderListParams as CustomProviderListParams, type CustomProviderDeleteParams as CustomProviderDeleteParams, type CustomProviderGetParams as CustomProviderGetParams, }; export { Logs as Logs, BaseLogs as BaseLogs, type LogListResponse as LogListResponse, type LogDeleteResponse as LogDeleteResponse, type LogEditResponse as LogEditResponse, type LogGetResponse as LogGetResponse, type LogRequestResponse as LogRequestResponse, type LogResponseResponse as LogResponseResponse, type 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, BaseDatasets as BaseDatasets, type DatasetCreateResponse as DatasetCreateResponse, type DatasetUpdateResponse as DatasetUpdateResponse, type DatasetListResponse as DatasetListResponse, type DatasetDeleteResponse as DatasetDeleteResponse, type DatasetGetResponse as DatasetGetResponse, type 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, BaseEvaluations as BaseEvaluations, type EvaluationCreateResponse as EvaluationCreateResponse, type EvaluationListResponse as EvaluationListResponse, type EvaluationDeleteResponse as EvaluationDeleteResponse, type EvaluationGetResponse as EvaluationGetResponse, type EvaluationListResponsesV4PagePaginationArray as EvaluationListResponsesV4PagePaginationArray, type EvaluationCreateParams as EvaluationCreateParams, type EvaluationListParams as EvaluationListParams, type EvaluationDeleteParams as EvaluationDeleteParams, type EvaluationGetParams as EvaluationGetParams, }; export { DynamicRouting as DynamicRouting, BaseDynamicRouting as BaseDynamicRouting, 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, BaseProviderConfigs as BaseProviderConfigs, type ProviderConfigCreateResponse as ProviderConfigCreateResponse, type ProviderConfigListResponse as ProviderConfigListResponse, type ProviderConfigListResponsesV4PagePaginationArray as ProviderConfigListResponsesV4PagePaginationArray, type ProviderConfigCreateParams as ProviderConfigCreateParams, type ProviderConfigListParams as ProviderConfigListParams, }; export { URLs as URLs, BaseURLs as BaseURLs, type URLGetResponse as URLGetResponse, type URLGetParams as URLGetParams, }; export { Billing as Billing, BaseBilling as BaseBilling, 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, }; } //# sourceMappingURL=ai-gateway.d.ts.map