Zum Inhalt springen
GigadriveDocs

Analytics

Read AI Gateway spend, tokens and latency by model, provider and user, and see which metric reaches your invoice.

Analytics aggregates the same rows as Request logs into totals you can act on: what was spent, on which models, by whom. Use it to attribute cost to an application before the invoice arrives.

In the console

Two pages sit at both /[org]/ai-gateway and the same paths inside an application. Overview opens on the last 7 days. Four numbers head it: requests with their success rate, spend, tokens split into input and output, and average latency, followed by recent requests and top models. Analytics opens on the last 30 days and charts spend, requests, tokens and average latency over time, then breaks the range down by model, by provider and by user. One switch reads each breakdown as cost, requests or tokens.

Both pages offer the last 24 hours, 7 days, 30 days or 90 days. The 24 hour range buckets by hour and the rest by day. Every money figure in the console is EUR.

The over-time charts are console-only. The API exposes the summary, the request log and a CSV export.

Reading the summary from the API

usage/summary accepts from, to and applicationId, and nothing else. It returns requestCount, successCount, errorCount, inputTokens, outputTokens, totalTokens, billableCostMicros and avgLatencyMs, then three breakdowns: byModel and byProvider hold the top 20 buckets by request count, byUser the top 50.

import { GigadriveClient } from '@gigadrive/sdk';

const client = new GigadriveClient({
  clientId: process.env.GIGADRIVE_CLIENT_ID,
  clientSecret: process.env.GIGADRIVE_CLIENT_SECRET,
});

const organizationId = '0197b2f0-8b6d-7c2a-9f4e-111111111111';

const usage = await client.organizations.aiGateway.usage.summary(organizationId, {
  from: '2026-08-01T00:00:00.000Z',
  to: '2026-09-01T00:00:00.000Z',
  applicationId: '0195c11c-0000-7000-8000-000000000042',
});

const eur = (micros: number) => (micros / 1_000_000).toFixed(2);

console.log(`${usage.summary.requestCount} requests, EUR ${eur(usage.summary.billableCostMicros)}`);

for (const row of usage.byModel) {
  console.log(row.label, row.requests, row.tokens, eur(row.costMicros));
}

Reading usage needs the network:ai_gateway:usage:read scope. It is not among the scopes gigadrive login requests, so the preceding CLI calls run against an organization API key exported as GIGADRIVE_CLIENT_ID and GIGADRIVE_CLIENT_SECRET.

Organization and application scope

These queries are organization-scoped by default. Passing applicationId narrows the same query to one application, which is exactly what the console does when you open AI Gateway inside an application rather than beside it. There is no separate application endpoint to learn.

Requests made with an application's own API key are attributed to that application automatically. A user token needs X-Gigadrive-Application-Id on the request for its usage to land in an application's figures rather than the organization's.

The metric that reaches your invoice

Two metrics are recorded per hour, per organization and application.

MetricBilled
ai_gateway_cost_eur_microsYes, at the metered amount, with no included allowance
ai_gateway_tokensNo. Recorded for reporting only

Tokens are not what you pay for. billableCostMicros on each request is computed from Gigadrive's own price table in EUR, never from the provider's reported cost, and it is that figure which is summed onto your bill. Cached input tokens bill at a model's discounted cached rate where it has one, and any request that used tokens is billed at least one micro.

Usage shows this alongside your other metered usage, and Invoices shows how it lands on a bill. Per-model rates live on the Models page in the console, in EUR per million tokens.