diff --git a/src/cloudflare/internal/ai-api.ts b/src/cloudflare/internal/ai-api.ts index 3dbdd307345..e5cfdc00950 100644 --- a/src/cloudflare/internal/ai-api.ts +++ b/src/cloudflare/internal/ai-api.ts @@ -20,9 +20,11 @@ export type SessionOptions = { export type GatewayOptions = { id: string; + cacheKey?: string; cacheTtl?: number; skipCache?: boolean; metadata?: Record; + collectLog?: boolean; }; export type AiOptions = { @@ -53,6 +55,7 @@ export class Ai { private logs: Array = []; private options: AiOptions = {}; public lastRequestId: string | null = null; + public aiGatewayLogId: string | null = null; public constructor(fetcher: Fetcher) { this.fetcher = fetcher; @@ -104,6 +107,7 @@ export class Ai { ); this.lastRequestId = res.headers.get('cf-ai-req-id'); + this.aiGatewayLogId = res.headers.get('cf-aig-log-id'); if (inputs['stream']) { if (!res.ok) { diff --git a/types/defines/ai.d.ts b/types/defines/ai.d.ts index b3fc2b03b98..812b612b795 100644 --- a/types/defines/ai.d.ts +++ b/types/defines/ai.d.ts @@ -175,9 +175,11 @@ export declare abstract class BaseAiTranslation { } export type GatewayOptions = { id: string; + cacheKey?: string; cacheTtl?: number; skipCache?: boolean; metadata?: Record; + collectLog?: boolean; }; export type AiOptions = { gateway?: GatewayOptions;