AI Gateway quickstart
By the end you will have a backend-managed key, a verified call and a request ID for troubleshooting.
1. Prepare your account
- Create or sign in to your Deployalo account.
- Open AI Gateway in the dashboard. The first visit prepares your personal gateway space; you can also use a team context.
- Under Balance, buy a top-up or request managed activation for a contract purchase.
- Under API Keys, select New key.
Use a different key for every application and environment. Never share a production key with notebooks, CI or development.
2. Configure the first key
A controlled starting point:
| Field | Starting point |
|---|---|
| Name | my-backend-dev |
| Allowed models | Only the model you will test |
| Daily cap | A small amount you can afford to use during testing |
| RPM | The minimum your application needs |
| Web search | Off unless required |
| Minimum privacy | Standard for this quickstart; review the privacy guide before real data |
| Allowed IPs | Your backend public IP if it is static |
The dplo_ai_... secret appears once. Deployalo stores its hash and a prefix, not a recoverable secret.
Store it in your application secret manager. Never in Git, a Docker image, a VITE_* variable, browser JavaScript or a support ticket.
export DEPLOYALO_AI_KEY="dplo_ai_..."
3. List allowed models
curl https://api.deployalo.com/ai/gateway/v1/models \
-H "Authorization: Bearer $DEPLOYALO_AI_KEY"
Useful filters:
GET /ai/gateway/v1/models?open_weights=true
GET /ai/gateway/v1/models?uncensored=true
GET /ai/gateway/v1/models?privacy=private
“Uncensored” describes model behavior, not an exemption from your policies, abuse controls, budget or applicable law.
4. Call with cURL
curl --fail-with-body https://api.deployalo.com/ai/gateway/v1/chat/completions \
-H "Authorization: Bearer $DEPLOYALO_AI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.5-flash",
"messages": [
{"role": "system", "content": "Answer concisely."},
{"role": "user", "content": "Explain what an API is in one sentence."}
]
}'
Check:
choices[0].message.contentfor text.usagewhen reported by the model.X-AI-Request-Idto correlate logs.X-AI-Cost-USD-CentsandX-AI-Wallet-Balance-USD-Centsfor reconciliation.X-AI-Upstream: deployalo; the internal provider route is not part of the public contract.
5. Connect your SDK
OpenAI SDK for Node.js
npm install openai
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.DEPLOYALO_AI_KEY,
baseURL: 'https://api.deployalo.com/ai/gateway/v1',
});
const response = await client.chat.completions.create({
model: 'google/gemini-2.5-flash',
messages: [{ role: 'user', content: 'Summarize this text: …' }],
});
console.log(response.choices[0].message.content);
OpenAI SDK for Python
pip install openai
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEPLOYALO_AI_KEY"],
base_url="https://api.deployalo.com/ai/gateway/v1",
)
response = client.chat.completions.create(
model="google/gemini-2.5-flash",
messages=[{"role": "user", "content": "Summarize this text: …"}],
)
print(response.choices[0].message.content)
Streaming
const stream = await client.chat.completions.create({
model: 'google/gemini-2.5-flash',
messages: [{ role: 'user', content: 'Write a short summary' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
Close or cancel the stream when the user leaves or the process stops. Cancelled streams may be settled with estimated usage when upstream totals are unavailable.
Anthropic Messages
POST /messages accepts the Anthropic Messages format. Use x-api-key + anthropic-version or Bearer. Streaming is not supported: stream: true returns 400.
curl https://api.deployalo.com/ai/gateway/v1/messages \
-H "x-api-key: $DEPLOYALO_AI_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-haiku-4.5",
"max_tokens": 100,
"messages": [{"role": "user", "content": "Say hello in one sentence"}]
}'
Responses API
POST /responses supports SSE streaming. It is stateless: store: true and previous_response_id are rejected. Keep required context in your application and do not assume server-side history.
6. Connect compatible tools
For tools with an OpenAI-compatible custom endpoint:
Base URL: https://api.deployalo.com/ai/gateway/v1
API Key: dplo_ai_...
Model: an ID returned by GET /models
- Cursor: Settings → Models → OpenAI API; set key and Override Base URL if supported by your version.
- Continue.dev: provider
openai,apiBasewith the base URL and an allowed model. - Dify, AnythingLLM, LobeChat, NextChat and OpenCat: choose OpenAI-compatible/custom endpoint.
Tool compatibility varies by version. Test streaming, images and tools independently; accepting a base URL does not guarantee every parameter.
7. Verify in the dashboard
- Usage: cost, tokens, requests and key/model/day breakdown.
- Requests: status, latency, model and cost per operation.
- Balance: wallet and accumulated consumption.
- Audit: administrative creation, changes and revocation.

Amounts and requests in this screenshot are demo data.
Common errors
| Response | What to check |
|---|---|
| 401 | Full secret, active key and Bearer header |
| 402 | Available balance and wallet expiry |
| 403 | Allowed model, IP/CIDR and web search |
| 429 | RPM or daily/weekly/monthly cap; use backoff |
| 400 | Payload, parameters and endpoint/privacy restrictions |
| 502 | Upstream failure after retries; retry with backoff and correlate your request log |
| 503 | Gateway coordination unavailable; avoid aggressive retry loops |
Do not automatically retry 400/401/402/403. For 429/5xx use exponential backoff with jitter and a retry limit.
Next step
Configure caps, guardrails, exports and the production checklist. Before personal data or documents, review privacy and retention.