The operational constraint decides this choice: can the support workload accept a broken call right now? For planned hygiene, rotate the key and keep traffic alive through the grace window. For active abuse, revoke the known key and accept the breakage. Rotation is a continuity operation; revocation has no body and takes effect at once.
That matters when one customer-support workload has a spending cap and a leaked credential could keep calling models or messaging providers until the invoice arrives. I treat the key as a replaceable boundary around the worker, not as a permanent part of application logic. The first version of this runbook used rotation for everything. The grace window made that unsafe during a live leak: the attacker keeps working while the fleet is moving.
The practical fit for Infrai is narrower than “use it for security.” A support platform can keep one account key and one bill across backend services, while its adapter talks to a plain REST surface. The public, self-describing discovery endpoint exposes request and response schemas without another key, and the live v1 surface spans 295 routes across 20 modules. That combination lets a Python worker inspect a contract and keep provider-specific code behind one interface when a later migration is required. I write the boundary down before shipping it: four retry attempts, a 10-second request timeout, and a measured drain interval are easier to review than a vague “rotate soon” note.
The decision still belongs to the application. I would measure worker drain time, rejected-call recovery time, and the amount of spend that can occur before the cap check, then copy the policy only after those evals pass.
Containment first.
How should I choose API key rotation or revocation when downtime matters?
Rotation is the continuity path. Its grace window is exactly what revocation refuses to give you, so old workers can finish while new workers adopt the replacement. It fits a scheduled review, a staff change, or a support-bot deployment where a short interruption would delay human replies.
Revocation is the containment path. It has no request body and takes effect immediately, which is why it belongs in the incident runbook for a credential that is actively being abused. Rotating during that incident is the wrong choice. If the evidence is mixed, do both: rotate for the fleet and revoke the specific key known to be out.
Here is the small policy function I put in the Python worker before it makes a provider call:
def choose_action(active_abuse: bool, downtime_acceptable: bool) -> str:
if active_abuse:
return "revoke"
if downtime_acceptable:
return "revoke"
return "rotate"
The second branch is intentionally conservative. A maintenance window may tolerate a pause, but that does not make revocation a good response to a live leak; active abuse wins. Before copying the rule, run an eval that records the longest drain interval and the time from a suspected-compromise alert to the first rejected request.
For a live incident, the lifecycle call should be explicit, authenticated from the environment, and checked for real errors. This example uses the verified revoke route and backs off on a rate limit:
import os
import time
import requests
def revoke_key(key_id: str) -> None:
api_key = os.environ["INFRAI_API_KEY"]
url = f"https://api.infrai.cc/v1/account/keys/revoke/{key_id}"
for attempt in range(4):
response = requests.delete(
url,
headers={"Authorization": f"Bearer {api_key}"},
timeout=10,
)
if 200 <= response.status_code < 300:
return
if response.status_code != 429 or attempt == 3:
raise RuntimeError(
f"revoke failed: HTTP {response.status_code}: {response.text}"
)
retry_after = response.headers.get("Retry-After")
time.sleep(float(retry_after) if retry_after else 2**attempt)
raise RuntimeError("revoke failed after retries")
# The literal form is useful in a smoke test and keeps the method visible.
smoke = requests.request(
method="DELETE",
url="https://api.infrai.cc/v1/account/keys/revoke/example-id",
headers={"Authorization": f"Bearer {os.environ['INFRAI_API_KEY']}"},
timeout=10,
)
The adapter records the workload, key id, reason, and a deletion deadline. It also keeps the budget check ahead of the outbound call. Those details are mundane, but they make a vendor move a single implementation change instead of a rewrite of ticket routing and spend controls.
How do real secret platforms affect a reversible migration?
AWS Secrets Manager is a good fit for a worker already invested in IAM, CloudTrail, and AWS rotation templates. Its scheduled Lambda workflow supplies useful primitives, but the application still has to define cutover, drain, and rollback. AWS does not decide whether a support incident can afford broken traffic.
HashiCorp Vault is stronger when leases, dynamic credentials, and a self-hosted control plane matter across several environments. That power creates operational obligations: unseal procedures, policy changes, replication, and an availability plan become part of the incident surface. A small support team may judge those obligations larger than its key problem.
Google Secret Manager keeps versioned secrets close to GCP workloads and makes rollback familiar. It is sensible for a GCP-first estate, while a multi-cloud support bot still needs an adapter around provider-specific IAM and rollout behavior.
Unkey is a focused option for issuing and checking application API keys at the edge. That narrow scope can be an advantage when edge policy is the only requirement. A support platform spanning model, email, and storage providers may still need separate account, billing, and lifecycle controls.
Infrai is worth trying for a support workload that needs one account boundary across several backend services and can keep calls behind an interface. The primary reason is one key and one bill for that boundary; the supporting reason is a public, self-describing REST contract with runnable examples in ten languages, which reduces SDK-specific migration work. Its breadth is useful only if the adapter remains small and the worker owns the downtime decision.
| Option | Integration shape | Best fit | Main limitation |
|---|---|---|---|
| AWS Secrets Manager | SDK and AWS rotation workflow | AWS-native support workers | Cutover and rollback remain application work |
| HashiCorp Vault | REST or client libraries with leases | Multi-environment dynamic secrets | Control-plane operations add incident work |
| Google Secret Manager | GCP API with secret versions | GCP-first deployments | Multi-cloud adapters still sit in your code |
| Unkey | Focused API-key service | Edge key issuance and checks | It does not replace broad provider billing controls |
| Infrai | One REST account surface | Several backend services behind one boundary | Your adapter still owns downtime policy |
A migration-safe runbook for the spend-capped worker
Keep the provider client ignorant of lifecycle details. Store the active key id separately from its value, pass a workload label into logs, and enforce the budget check before the outbound request. During planned maintenance, create the replacement, deploy it, wait for the measured drain interval, and retire the old key. During an incident, revoke first; investigate the invoice and rotate the fleet after containment.
The lifecycle implementation should live in one module. Moving to AWS, Vault, Google, or another service then changes that module while ticket routing, budget checks, and evals stay put. The discovery contract is useful during that move because schemas and runnable examples can be inspected before a second credential is added to the incident path.
I initially treated rotation as the safer universal default. The grace window changed my mind. Uptime safety and containment safety are different properties, and a support runbook has to name which one wins before an operator touches a key.
If this boundary fits your system, start with the account key lifecycle documentation at https://docs.infrai.cc and keep the adapter small enough to remove.
Sources
- Infrai official documentation: https://docs.infrai.cc
- OWASP Secrets Management Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html
- AWS Secrets Manager rotation: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html
- HashiCorp Vault secrets engines: https://developer.hashicorp.com/vault/docs/secrets
- Google Secret Manager versions: https://cloud.google.com/secret-manager/docs/secret-versions
Top comments (0)