Skip to main content

AI Gateway resources and CRUD

For task-oriented setup, workspace creation, and integration-binding examples, start with the AI Gateway workflow cheat sheet.

airs aigateway exposes the AI Gateway surface in SDK 0.20.0. Commands follow one grammar:

airs aigateway <resource> <action> [id]

Run any group with --help to see its identifiers, required flags, and examples. All reads accept --output pretty|table|markdown|csv|json|yaml; JSON list output is a bare array. AI Gateway reuses the PANW_MGMT_* OAuth credentials and optionally accepts the PANW_AI_GW_*_ENDPOINT overrides.

Command map

ResourceCommandsPlane and notes
api-keys servicelist, get, create, update, delete, rotateData plane; list requires a workspace UUID.
api-keys userlist, get, create, update, delete, rotateData plane; user create bodies include user_id.
audit-logslistAdmin plane; defaults to the previous seven days.
configslist, get, versions, create, update, deleteData plane; delete is permanent.
deploymentslist, get, create, update, archive, pingAdmin plane; archive is soft removal.
guardrailslist, get, create, update, deleteData plane; delete is permanent.
integrationslist, get, create, update, deleteAdmin plane; includes models list/set and workspaces list/set.
mcp integrationslist, get, create, update, deleteAdmin plane; includes capabilities, metadata, and workspace access.
organisationsself get/update, auth-settings get/updateAdmin plane; auth settings require the numeric TSG id.
pluginslist, createAdmin plane; the SDK has no verified get/update/delete endpoints.
providerslist, get, create, update, deleteData plane; detail credentials are redacted by default.
telemetrycache, cost, errors, feedback, grouping, latency, logs, requests, retries, tokens, usersData plane; uses workspace slug.
workspaceslist, get, create, update, archiveReads span both planes; writes use the admin plane.

workspace remains an accepted compatibility alias for workspaces. The deprecated workspace delete spelling still archives and prints a warning; it deliberately has no rm alias. Use workspaces archive in new automation.

Structured mutation input

AI Gateway mutations use named flags for stable fields and repeatable dotted assignments for nested configuration. No request file is required:

# Create a routing config
airs aigateway configs create \
--name primary-routing \
--workspace <workspace-uuid> \
--set config.retry.attempts=3 \
--set config.strategy.mode=fallback \
--output json

# Create a guardrail one field at a time
airs aigateway guardrails create \
--name deny-risk \
--workspace <workspace-uuid> \
--set 'checks[0].id=prompt-injection' \
--set actions.deny=true

# Preserve existing MCP bindings while changing one workspace
airs aigateway mcp integrations workspaces set <integration-id> \
--workspace-binding <workspace-id>=false \
--global-access false \
--preserve-existing \
--force --output json

--set <path=value> parses JSON scalars, arrays, and objects when possible; otherwise the value is a string. Use --set-string <path=value> when a value such as 123, true, or null must remain a literal string. Dot segments create objects and bracket indexes create arrays. Unsafe prototype segments, sparse arrays, conflicting paths, non-finite values, and request-schema violations fail before OAuth or network access.

The dotted path addresses the SDK request body, so config routing settings begin with config. and integration-specific settings begin with configurations.. Run the exact leaf command with --help for its named flags and known values sourced from SDK 0.20 catalogs.

File escape hatch

--file <json|yaml> remains an optional advanced base for generated or provider-specific bodies. Named flags override file fields, and --set / --set-string apply last:

airs aigateway integrations update <integration-id> \
--file provider-base.yaml \
--name vertex-production \
--set configurations.vertex_region=us-central1

The merged body is validated against the exported SDK operation schema. Relationship set commands replace access, models, or capabilities by default and therefore require confirmation; pass --preserve-existing only when workspace bindings should be additive. Use --force only after inspecting the exact target id and options.

Hard delete operations also require confirmation and receive the rm alias. Workspace and deployment soft removal is named archive, never rm. Integration delete and deployment archive also require --organisation-id <numeric-tsg-id>.

One-time credentials

API-key create/rotate, deployment create, and deployment updates with --rotate-auth true refuse to call the API until a secret destination is chosen:

airs aigateway api-keys service create \
--name ci-gateway \
--organisation-id <numeric-tsg-id> \
--workspace <workspace-uuid> \
--type workspace \
--scopes completions.write \
--secret-output ./api-key.secret.json

airs aigateway deployments create \
--name private-gateway \
--type production \
--organisation-id <numeric-tsg-id> \
--secret-output ./deployment.secret.json

airs aigateway deployments update <deployment-id> \
--rotate-auth true \
--secret-output ./rotated-deployment.secret.json

--secret-output reserves a new file with mode 0600 before confirmation or the API call and will not overwrite an existing path. API failure or declined confirmation removes that reserved file. --show-secret is available for deliberate piping. Debug API logs recursively redact tokens, secrets, credentials, passwords, authorization fields, and API keys. API-key list/detail reads, provider detail, and organisation authentication settings are redacted by default; their --reveal-sensitive flags are explicit opt-ins. Operation-scoped secret paths come from SDK 0.20 metadata.

Deployment health

deployments get reports the control plane's deployment record and heartbeat state. deployments ping is a separate, optional control-plane-to-data-plane ingress diagnostic. A private gateway can be healthy through outbound heartbeat while ping fails because ingress is intentionally blocked; do not interpret the ping result as the only health signal.

Local live-safe E2E

Place management credentials in the ignored, owner-only .env.ai-gateway.local file and run:

pnpm test:e2e:aigateway

Set AI_GATEWAY_E2E_WORKSPACE_SLUG to override the default dev workspace ws-develo-71f8d8. Inventory and telemetry checks are read-only. One mutation test creates, updates, verifies, and hard-deletes a uniquely named disposable config through structured flags; its finally cleanup retries the exact delete if an intermediate assertion fails. The suite does not alter established resources.