Gateway Integration
Alephant Gateway lets you route LLM requests through Alephant Virtual Keys instead of exposing raw provider keys in applications. Requests remain provider-compatible while Alephant applies authentication, routing, logging, budgets, policy checks, and analytics.
Configure a Virtual Key
- Add a provider key in Keys. This is the upstream provider credential that Alephant stores securely.
- Create an Agent or Virtual Key for the application, service, or user that will send traffic.
- Configure the key with the provider, model access, department, budgets, and policies you want to enforce.
- Copy the generated
vk-...token. This token is the credential your application sends to Alephant Gateway.
Use separate Virtual Keys for different apps, environments, agents, or teams. This keeps logs, cost attribution, and policy enforcement clear.
Send Requests Through the Gateway
Use the Gateway base URL configured for your environment and pass the Virtual Key in the standard Authorization header.
For gateway requests, use a Virtual Key. Do not send your provider API key to Alephant; the gateway injects the configured upstream credential after authenticating the Virtual Key.
Required Headers
Optional Tracking Headers
These headers help you attach business context to requests and improve logs, analytics, and debugging. Headers marked as gateway-only are not forwarded to the upstream model provider.
Example with request tracking:
Cache Headers
Alephant supports gateway-side response caching. Cache headers are optional and are not sent to the upstream model provider.
Semantic cache and embedding headers are advanced gateway controls. Use them only when your workspace has semantic caching configured:
Logging and Privacy Controls
Some headers affect request logging behavior.
Avoid putting secrets or regulated personal data in custom alephant-property-* headers. They are intended for operational metadata that is safe to display in logs.
Client IP and Policy Evaluation
The gateway evaluates policies using request metadata, including headers that can be represented as UTF-8. For client IP:
x-forwarded-formay be used by policy evaluation, with the leftmost IP treated as the client IP.- Rate limiting only trusts
x-forwarded-forwhen the direct peer is a configured trusted proxy. Otherwise, the direct peer IP is used.
Response Headers
Gateway responses may include Alephant-specific response metadata, such as:
Verify Requests
After sending a request through the gateway:
- Open Logs to confirm the request was recorded.
- Check Analytics for spend, requests, token usage, model, provider, and scoped metadata.
- If a request fails, check the HTTP status and policy or budget configuration for the Virtual Key.
Common failures include invalid Virtual Key authentication, policy blocks, rate limits, unsupported models, or budget enforcement.