Skip to content
GigadriveDocs

AI Gateway

Call models and manage usage, budgets and policies with gigadrive ai.

gigadrive ai has two halves. models and chat run inference through the Gigadrive Network AI Gateway; usage, budgets and policies read and write an organization's spend controls.

Models

gigadrive ai models list takes no arguments and no flags.

gigadrive ai models list
anthropic/claude-haiku-4-5  Claude Haiku 4.5 (latest)  (ctx 200000)
openai/gpt-4o  GPT-4o  (ctx 128000)
openai/gpt-4o-mini  GPT-4o mini  (ctx 128000)

gigadrive ai models get <model-id> prints one model as JSON, including provider, capabilities (chat, streaming, tools, vision, json_mode), contextWindow, maxOutputTokens, routingProviders and zdrProviders.

gigadrive ai models get openai/gpt-4o

Models describes what the catalog covers.

Chat

gigadrive ai chat sends exactly one user message and prints the reply. --model is required.

Argument or flagAliasDescription
promptThe prompt text, or - to read from stdin
--model-mThe model ID to use, e.g. openai/gpt-4o
--streamStream the response token by token
gigadrive ai chat "Write a release note for a cache invalidation fix" --model openai/gpt-4o

Without --stream the command waits for the whole completion, then prints the assistant message, and prints it as JSON when the content is not a plain string. With --stream, content chunks go to stdout as they arrive and a newline closes the output.

Pass - to read the prompt from stdin:

gigadrive ai chat - --model openai/gpt-4o --stream < CHANGELOG.md

There is no flag for a system prompt, a temperature or a token limit. Use the SDK when you need one.

Usage

The three usage subcommands are scoped to an organization. --org wins; otherwise the CLI takes organizationId from .gigadrive/project.json and fails when the link carries none. All three accept --org/-o, --app/-a, --from and --to, where --from and --to are ISO 8601 timestamps and both bounds are inclusive.

summary prints JSON: a summary object with requestCount, successCount, errorCount, inputTokens, outputTokens, totalTokens, billableCostMicros and avgLatencyMs, plus byModel, byProvider and byUser breakdowns.

gigadrive ai usage summary --from 2026-07-01T00:00:00Z --to 2026-08-01T00:00:00Z

requests prints one line per gateway request, newest first, then a count of the request lines. The status is one of pending, success, error or cancelled.

2026-08-12T09:14:22.000Z  openai/gpt-4o  success  1841 tok  9205µ$
2026-08-12T09:12:07.000Z  openai/gpt-4o-mini  error  0 tok  0µ$

2 request(s).

The CLI sends no page size, so the API's default of the 100 most recent matching events applies. Use export for a range that runs longer than that.

export produces CSV and takes the maximum page size of 500 events by default. It writes to stdout unless you add --out, which takes a path and prints Wrote <path>. instead.

gigadrive ai usage export --from 2026-07-01T00:00:00Z --to 2026-08-01T00:00:00Z --out july.csv

Budgets

gigadrive ai budgets get accepts --org and prints the budget list as JSON.

gigadrive ai budgets set replaces the entire budget set for the organization. It reads JSON from --file, or from stdin when --file is absent or -, and accepts either a bare array or an object of the form { "budgets": [...] }. Every per-budget field is optional: applicationId, userId, period (day or month), maxCostMicros, maxRequests, maxTokens, maxRequestCostMicros and enabled.

cat > budgets.json <<'JSON'
[
  { "period": "month", "maxCostMicros": 50000000, "enabled": true },
  { "period": "day", "applicationId": "0195c11c-0000-7000-8000-000000000042", "maxRequests": 10000 }
]
JSON
gigadrive ai budgets set --file budgets.json

Because it is a replace and not a merge, an empty array clears every budget:

echo '[]' | gigadrive ai budgets set --org 0195c0aa-0000-7000-8000-0000000000ff

Budgets explains what each cap does when it is hit.

Policies

gigadrive ai policies get accepts --org and --app, and prints the policy as JSON or the line No policy set.

gigadrive ai policies set accepts --org and --file only. To target a single application, put applicationId in the JSON body; there is no --app on this subcommand. The body is sent as given, so a typo in a field name is not caught locally.

cat > policy.json <<'JSON'
{
  "allowedModels": ["openai/gpt-4o", "openai/gpt-4o-mini"],
  "requireZdr": true,
  "allowFallbacks": false,
  "maxOutputTokens": 4096
}
JSON
gigadrive ai policies set --file policy.json

Setting allowedModels or allowedProviders to null allows everything. Policies covers the enforcement rules.