API Gateway: Unified LLM Access and Key Management
Route all your LLM requests through a single endpoint, manage which models are available, and generate access keys to control who can call them.
The API Gateway is a LiteLLM-compatible proxy built into Forjinn that sits between your application and any LLM provider. Instead of hardcoding provider-specific API keys into every integration, you register models once in the gateway, issue gateway API keys to your team or applications, and route all requests through a single endpoint. The gateway handles forwarding to the correct provider, so you can swap out or add models without touching your application code.
From the API Gateway section in the sidebar you can manage which models are active, generate and revoke access keys, and review usage.
Add a model to the gateway
In the left sidebar, click API Gateway.
Select the Models tab. You'll see all models currently registered with the gateway.
Click Add Model. Fill in the following fields:
| Field | Description |
|---|---|
| Model name | The name callers will use to request this model (e.g. gpt-4o, claude-3-5-sonnet) |
| Provider | The LLM provider (e.g. OpenAI, Anthropic, Azure, Mistral) |
| API key | The provider API key the gateway will use when forwarding requests |
| Base URL | Required for Azure or self-hosted models; leave blank for public providers |
Click Save. The model is immediately available through the gateway endpoint.
Register models under the same names as the underlying provider models (e.g. gpt-4o) so existing OpenAI-compatible client code works without modification — just point the base URL at your Forjinn gateway.
Generate a gateway API key
Gateway API keys control access to the proxy. Issue separate keys for each application, team, or environment so you can revoke them independently.
Click API Gateway in the sidebar.
Select the Keys tab.
Click Generate Key. Optionally set a label or rate limit for the key.
Copy the key immediately — it is only shown once. Store it securely.
Gateway keys are not the same as Forjinn API keys (found under API Keys in the sidebar). Gateway keys authenticate requests to the LLM proxy endpoint. Forjinn API keys authenticate requests to the Forjinn REST API.
Sending requests through the gateway
The gateway exposes a LiteLLM-compatible endpoint. Any OpenAI SDK or HTTP client that supports a custom base URL can use it by pointing to your Forjinn instance.
Example using the OpenAI Python SDK:
from openai import OpenAI
client = OpenAI(
base_url="https://your-forjinn-instance.com/api/v1/gateway",
api_key="your-gateway-api-key"
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarize today's top AI news."}]
)
print(response.choices[0].message.content)Example using curl:
curl -X POST https://your-forjinn-instance.com/api/v1/gateway/chat/completions \
-H "Authorization: Bearer your-gateway-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello"}]
}'Gateway API reference
| Method | Endpoint | Description |
|---|---|---|
GET | /api/v1/gateway/models | List all registered models |
POST | /api/v1/gateway/models | Register a new model |
DELETE | /api/v1/gateway/models | Remove a model from the gateway |
POST | /api/v1/gateway/keys | Generate a new gateway API key |
GET | /api/v1/gateway/keys | List existing gateway API keys |
Remove a model
To remove a model from the gateway, go to API Gateway → Models, find the model in the list, and click Delete. Requests that reference the deleted model name will fail after removal. Existing keys are not affected — they can still be used with any remaining registered models.
Evaluations: Measure and Track Agent Quality
Test your AI agents against curated datasets and custom scoring criteria to measure quality, catch regressions, and track improvement over time.
Evaluators — Configure Metrics and Scoring for AI Agent Assessment
Learn how to set up evaluators in Forjinn. Choose from built-in evaluation types, configure custom metrics, and establish scoring systems for thorough AI agent quality assessment.