cloudflare
Version:
The official TypeScript library for the Cloudflare API
231 lines • 6.86 kB
TypeScript
import { APIResource } from "../../core/resource.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 BaseCustomProviders extends APIResource {
static readonly _key: readonly ['aiGateway', 'customProviders'];
/**
* Creates an account-level custom provider that forwards AI Gateway requests to
* the HTTPS base URL you supply. Requests reference the provider as
* `custom-{slug}`, so the slug must be unique within the account.
*
* @example
* ```ts
* const customProvider =
* await client.aiGateway.customProviders.create({
* account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0',
* base_url: 'https://example.com',
* name: 'name',
* slug: 'slug',
* });
* ```
*/
create(params: CustomProviderCreateParams, options?: RequestOptions): APIPromise<CustomProviderCreateResponse>;
/**
* Lists the custom providers configured for the account, ordered by position and
* then name.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customProviderListResponse of client.aiGateway.customProviders.list(
* { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' },
* )) {
* // ...
* }
* ```
*/
list(params: CustomProviderListParams, options?: RequestOptions): PagePromise<CustomProviderListResponsesV4PagePaginationArray, CustomProviderListResponse>;
/**
* Deletes a custom provider and every pricing rule that belongs to it.
*
* @example
* ```ts
* const customProvider =
* await client.aiGateway.customProviders.delete(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' },
* );
* ```
*/
delete(id: string, params: CustomProviderDeleteParams, options?: RequestOptions): APIPromise<CustomProviderDeleteResponse>;
/**
* Retrieves a custom provider, including its slug, base URL, and custom headers.
*
* @example
* ```ts
* const customProvider =
* await client.aiGateway.customProviders.get(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: '3ebbcb006d4d46d7bb6a8c7f14676cb0' },
* );
* ```
*/
get(id: string, params: CustomProviderGetParams, options?: RequestOptions): APIPromise<CustomProviderGetResponse>;
}
export declare class CustomProviders extends BaseCustomProviders {
}
export type CustomProviderListResponsesV4PagePaginationArray = V4PagePaginationArray<CustomProviderListResponse>;
export interface CustomProviderCreateResponse {
id: string;
base_url: string;
created_at: string;
modified_at: string;
name: string;
slug: string;
beta?: boolean;
curl_example?: string;
description?: string;
enable?: boolean;
/**
* JSON object of extra HTTP headers that AI Gateway sends to the provider. Values
* can contain credentials.
*/
headers?: string;
js_example?: string;
link?: string;
logo?: string;
position?: number;
}
export interface CustomProviderListResponse {
id: string;
base_url: string;
created_at: string;
modified_at: string;
name: string;
slug: string;
beta?: boolean;
curl_example?: string;
description?: string;
enable?: boolean;
/**
* JSON object of extra HTTP headers that AI Gateway sends to the provider. Values
* can contain credentials.
*/
headers?: string;
js_example?: string;
link?: string;
logo?: string;
position?: number;
}
export interface CustomProviderDeleteResponse {
id: string;
base_url: string;
created_at: string;
modified_at: string;
name: string;
slug: string;
beta?: boolean;
curl_example?: string;
description?: string;
enable?: boolean;
/**
* JSON object of extra HTTP headers that AI Gateway sends to the provider. Values
* can contain credentials.
*/
headers?: string;
js_example?: string;
link?: string;
logo?: string;
position?: number;
}
export interface CustomProviderGetResponse {
id: string;
base_url: string;
created_at: string;
modified_at: string;
name: string;
slug: string;
beta?: boolean;
curl_example?: string;
description?: string;
enable?: boolean;
/**
* JSON object of extra HTTP headers that AI Gateway sends to the provider. Values
* can contain credentials.
*/
headers?: string;
js_example?: string;
link?: string;
logo?: string;
position?: number;
}
export interface CustomProviderCreateParams {
/**
* Path param
*/
account_id: string;
/**
* Body param
*/
base_url: string;
/**
* Body param
*/
name: string;
/**
* Body param
*/
slug: string;
/**
* Body param
*/
beta?: boolean;
/**
* Body param
*/
curl_example?: string;
/**
* Body param
*/
description?: string;
/**
* Body param
*/
enable?: boolean;
/**
* Body param: JSON object of extra HTTP headers that AI Gateway sends to the
* provider. Values can contain credentials.
*/
headers?: string;
/**
* Body param
*/
js_example?: string;
/**
* Body param
*/
link?: string;
/**
* Body param
*/
position?: number;
}
export interface CustomProviderListParams extends V4PagePaginationArrayParams {
/**
* Path param
*/
account_id: string;
/**
* Query param
*/
beta?: boolean;
/**
* Query param
*/
enable?: boolean;
/**
* Query param: Search by id, name, slug
*/
search?: string;
}
export interface CustomProviderDeleteParams {
account_id: string;
}
export interface CustomProviderGetParams {
account_id: string;
}
export declare namespace CustomProviders {
export { 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, };
}
//# sourceMappingURL=custom-providers.d.ts.map