Authentication in Agumbe AI Gateway is designed to support both interactive product workflows and production-grade application traffic. At a high level, the gateway accepts authenticated requests in two ways:Documentation Index
Fetch the complete documentation index at: https://agumbe.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
- Gateway API keys for backend, service-to-service, and production integrations
- Session-based authentication for signed-in users working through the Agumbe Console
Why authentication matters
Every authenticated request helps the gateway determine:- which tenant owns the traffic
- which user or system is making the call
- which app policy should apply
- which limits and guardrails should be enforced
- how request logs, usage, and billing metadata should be attributed
Authentication methods
Gateway API keys
Gateway API keys are the primary authentication method for application traffic. Use a Gateway API key when:- your backend sends chat or embeddings requests to Agumbe
- a worker or internal service calls the gateway
- you want a stable credential for production use
- you need app-level or tenant-level policy enforcement
Authorization: Bearer AGUMBE_API_KEY
Example:
Session authentication
Session authentication is used when a signed-in user interacts with Agumbe through the Console. This flow is useful for:- trying requests in the playground
- configuring guardrails
- viewing request logs
- managing platform settings from the Console
Recommended production pattern
For almost every customer integration, use this pattern: Your client application -> Your backend -> Agumbe AI Gateway This gives you several advantages:- your Gateway API key stays private
- your backend can decide which app or policy to use
- you can add retries, logging, request validation, and business rules in one place
- you keep full control over how end-user actions map to gateway traffic
API key scopes
Agumbe supports two important API key usage patterns:- tenant-scoped API keys
- app-scoped API keys
Tenant-scoped API keys
A tenant-scoped API key can be used across multiple apps within the same tenant. Use a tenant-scoped key when:- one backend service powers multiple AI workflows
- you want to choose the app policy per request
- your platform has several app contexts behind one service
App-scoped API keys
An app-scoped API key is bound to one app. Use an app-scoped key when:- a workload should always use one app policy
- you want stronger isolation between environments or workloads
- you want to reduce the risk of sending traffic under the wrong app context
- a service or deployment has a single clear AI purpose
How the gateway resolves identity
When a request is authenticated successfully, the gateway associates it with runtime context such as:- tenant
- user or system identity
- app
- key scope
- subject type
- guardrail policy lookup
- usage controls
- request logging
- observability
- spend attribution
- rate limiting and quota enforcement
Example: authenticating with a backend SDK
If you are integrating from a backend service, configure your SDK with your Gateway API key and the Agumbe base URL.TypeScript
Python
Handling app selection correctly
If your backend uses a tenant-scoped key, your service should decide which app policy applies before it sends the request to Agumbe. This usually happens in one of these ways:- each route maps to a fixed app ID
- each customer workflow maps to a fixed app ID
- your backend derives the correct app ID from the request context
- you separate staging, development, and production by app ID
Security best practices
Use the following authentication practices in production.Keep keys server-side
Always store Gateway API keys in backend environment variables or a secure secrets manager. Do not expose them to browsers, mobile clients, or public frontend bundles.Separate environments
Use different keys for development, staging, and production. This makes it easier to:- rotate credentials safely
- isolate request logs by environment
- apply different guardrails
- reduce blast radius if a key must be revoked
Prefer app-scoped keys for sensitive workloads
If a workflow handles regulated content, internal knowledge, customer support, finance, or high-sensitivity operations, use an app-scoped key whenever possible. This reduces the chance of applying the wrong policy set.Rotate keys deliberately
Treat Gateway API keys as production credentials. Rotate them through your standard secret management process and revoke unused keys promptly.Keep authentication logic simple
The safest production systems are usually the simplest ones. Avoid building overly dynamic app selection logic unless your architecture truly needs it.Common authentication errors
When authentication fails, the gateway returns a structured error response. Example:- unauthorized when no valid bearer token or session is present
- app_mismatch when an app-scoped key is used with the wrong app ID
- forbidden when an operation requires elevated permissions
- guardrail_policy_forbidden when an app credential attempts to update guardrail policies
When to use which method
Choose Gateway API keys if:- you are integrating Agumbe into an application
- you need production-ready authentication
- your backend or worker is calling the gateway
- you want stable credential management and policy control
- you are working inside the Agumbe Console
- you are testing in the playground
- you are configuring product settings interactively
- one service needs to work across multiple apps
- your backend selects the app policy per request
- the workload should always use one app policy
- you want tighter isolation and safer production defaults
Recommended starting point
If you are integrating Agumbe for the first time, start with:- a backend service
- one Gateway API key
- one app-scoped key for one real workload
- one stable model alias such as smart-default
- one app-level guardrail policy
Next steps
Once authentication is set up, the next pages to read are:- Models and Aliases to understand how model selection works
- Guardrails to learn how app-level policies are applied
- Go to Production for deployment and operational guidance