Credentials
Crafted AI separates several credential surfaces. They are related, but they serve different paths:
- Provider keys (BYOK) — your own OpenAI or Anthropic API keys, stored encrypted on our side and used to call the upstream provider.
- Gateway keys —
cai_…tokens that your applications use to call the Crafted AI gateway. These authenticate requests, identify your organisation, and carry per-key rate limits. - Integration credentials — optional credentials used by MCP servers or external integrations.
- Twilio credentials — Account SID, Auth Token, and WhatsApp sender used by the WhatsApp product.
You need at least one provider key and one gateway key for API traffic. WhatsApp also needs Twilio credentials and a default organisation model.
Provider keys (BYOK)
Section titled “Provider keys (BYOK)”- Open app.craftedai.co and navigate to Credentials → Provider keys.
- Click Add OpenAI key or Add Anthropic key and paste the key.
- The key is encrypted with the gateway’s
MODEL_CONFIG_ENCRYPTION_KEY(AES-GCM) before it touches the database. We never return the value after it is stored. - Rotate by adding a replacement key, switching traffic via the model catalog, then deleting the old key.
You can have one provider key per provider per organisation. Multi-key fan-out (e.g. cost-shifting between two OpenAI accounts) is on the roadmap.
Gateway keys
Section titled “Gateway keys”Gateway keys are how your application authenticates to the Crafted AI gateway. Each key has:
- A
cai_…value, shown exactly once at creation time. - An optional requests-per-minute (RPM) cap — enforced via Redis counters on every request.
- An optional daily token cap — combined prompt + completion tokens, enforced on the same Redis counters.
- An optional external user ID — a free-text label that flows through to usage reporting so you can attribute calls to your end users.
Minting a key
Section titled “Minting a key”- Go to Credentials → Gateway keys.
- Click New key, set an optional label, RPM, and daily token cap.
- Copy the
cai_…value immediately. We do not store it in plain text and cannot show it again.
Rotation
Section titled “Rotation”Rotate keys whenever a value may have leaked, or on a schedule that fits your security posture. The recommended flow is:
- Mint a new gateway key with the same RPM and daily token caps.
- Roll the new value out to your applications.
- Watch the old key’s traffic drop to zero in app.craftedai.co/usage.
- Delete the old key.
Rate-limit behaviour
Section titled “Rate-limit behaviour”When a gateway key hits its RPM or daily token cap, the gateway returns
429 rate_limit_exceeded in the standard OpenAI envelope:
{ "error": { "message": "Rate limit exceeded for this gateway key.", "type": "rate_limit_error", "param": null, "code": "rate_limit_exceeded" }}Per-key rate limits fail closed if Redis is unreachable — a deliberate
trade-off, because these caps protect against runaway provider spend. Auth
endpoints (/auth/*) on the control panel use a different, fail-open
limiter; the gateway never does.
Integration credentials
Section titled “Integration credentials”MCP integrations may reference a stored credential when the MCP server requires authentication. Keep these credentials scoped to the MCP server’s narrow job:
- Prefer read-only or least-privilege service accounts.
- Avoid sharing provider keys with MCP servers unless that MCP server truly needs direct provider access.
- Rotate when a server, vendor, or team member changes.
- Refresh the MCP tool catalog after changing endpoint or credential settings.
Twilio credentials for WhatsApp
Section titled “Twilio credentials for WhatsApp”The WhatsApp product uses Twilio as the transport. For the MVP, customers bring their own Twilio account.
WhatsApp app configuration stores:
twilioNumber— the sender, formatted aswhatsapp:+15551234567.twilioAccountSid— encrypted before storage.twilioAuthToken— encrypted before storage.
Read paths return only masked Twilio credential values. Rotation requires supplying the Account SID and Auth Token together, because Twilio credentials are treated as a paired secret.
See WhatsApp for the full setup flow.
What’s next
Section titled “What’s next”BYOK fan-out, per-key model allowlists, team-scoped gateway keys, managed Twilio onboarding, and richer integration-secret management are all on the roadmap. Track them in the changelog.