分析とログ
Your AI Gateway dashboard shows metrics on requests, tokens, caching, errors, and cost. You can filter these metrics by time and provider-type.
To view analytics in the dashboard:
- Log into the Cloudflare dashboard ↗ and select your account.
- Go to AI > AI Gateway.
- Make sure you have your gateway selected.
GraphQLを使用して、AI Gatewayダッシュボードの外で使用データをクエリできます。以下の例のクエリを参照してください。リクエストを行う際にはCloudflareトークンを使用し、{account_id}をアカウントタグに合わせて変更する必要があります。
curl https://api.cloudflare.com/client/v4/graphql \ --header 'Authorization: Bearer TOKEN \ --header 'Content-Type: application/json' \ --data '{ "query": "query{\n viewer {\n accounts(filter: { accountTag: \"{account_id}\" }) {\n requests: aiGatewayRequestsAdaptiveGroups(\n limit: $limit\n filter: { datetimeHour_geq: $start, datetimeHour_leq: $end }\n orderBy: [datetimeMinute_ASC]\n ) {\n count,\n dimensions {\n model,\n provider,\n gateway,\n ts: datetimeMinute\n }\n \n }\n \n }\n }\n}", "variables": { "limit": 1000, "start": "2023-09-01T10:00:00.0Z", "end": "2023-09-30T10:00:00.0Z", "orderBy": "date_ASC" }}'あなたのAI Gatewayダッシュボードは、プロンプト、レスポンス、プロバイダー、タイムスタンプ、リクエストが成功したか、キャッシュされたか、エラーがあったかなど、個々のリクエストのリアルタイムログも表示します。これらのログは保持されず、24時間後に削除されます。