API Key Governance
Manage programmatic access to Sweetnight AIX services with scoped, revocable API credentials.
Key Lifecycle
API Key Security Invariants
- Cryptographically Hashed: Keys are salted and stored via SHA-256 at rest; raw secrets are never logged or retrievable after issuance.
- Strictly Scoped: Enforced by tenant, environment (prod/stage/dev), and granular permission gates.
- Budget & Rate Limiting: Per-key requests-per-minute (RPM) and token budget quotas trip circuit breakers on overage.
- Automatic Lifecycle Rotation: Configurable TTL windows with automated expiration notifications.
Generating an API Key
- Navigate to Developer → API Keys (
/dashboard/settings/api-keys). - Click Generate New Key.
- Choose a descriptive name (e.g.,
ci-agent-runnerorproduction-backend-svc). - Select the environment:
Production,Staging, orDevelopment. - Define explicit permission scopes:
agent:read— Query agent metadata and configurationagent:execute— Invoke agent runs and stream inferencemcp:invoke— Call MCP tools directlymodels:read— List accessible model endpoints
- Set an optional expiration window (30 days, 90 days, or never).
- Copy your secret key immediately (
aix_live_...). For security, the raw key is never displayed again.
Authentication in Code
Provide your API key in the Authorization header as a Bearer token:
cURL
curl -X POST https://aix.snnc.cc/api/v1/chat/completions \
-H "Authorization: Bearer aix_live_xxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3-72b",
"messages": [{"role": "user", "content": "Analyze quarterly trends"}]
}'Python (Agent SDK)
from agent_sdk import Client
client = Client(api_key="aix_live_xxxxxxxxxxxxxxxxxxxx")
response = client.agents.run(
agent_id="ag_merchandising_analyst",
query="Analyze Q3 inventory turnover"
)
print(response.output)Quotas and Rate Limiting
Each API key is governed by your organization’s subscription tier:
- Requests Per Minute (RPM): Default
120 RPM, burstable up to600 RPM. - Tokens Per Minute (TPM): Monitored in real-time under Usage & Billing.
- Exceeding thresholds returns an HTTP
429 Too Many Requestsstatus with standardRetry-Afterheaders.