Quickstart
This quickstart for Local AI models sends one model request on a provider account you connect as a test customer, instead of on your own.
alien examples ai-gateway --protocol openai-chat --model byo/claude-opus-5Every step uses the Alien CLI. Run them from a directory linked to your Alien project.
Enable the gateway
Choose one AI model to test, and make it required so initial setup checks it:
alien projects capabilities enable ai --required-model byo/claude-opus-5Create a server API key for the AI Gateway, the API that routes requests to each customer's provider:
alien api-keys create --for ai-gateway --description local-quickstartThe secret is shown once. Save it, with the external ID you'll use for this test customer:
export ALIEN_AI_API_KEY="..."
export CUSTOMER_ID="org_test"Connect a test account
alien onboard "Test customer" --external-id "$CUSTOMER_ID" --setup-items modelsOpen the printed link. In the deployment portal, the branded setup page Alien hosts, connect a provider account you control.
Send a request
Print a ready-to-run request for your environment:
alien examples ai-gateway --protocol openai-chat --model byo/claude-opus-5Run the printed command. It's equivalent to:
curl "https://ai.alien.dev/v1/chat/completions" \
-H "Authorization: Bearer $ALIEN_AI_API_KEY" \
-H "X-Alien-External-ID: $CUSTOMER_ID" \
-H "Content-Type: application/json" \
-d '{"model": "byo/claude-opus-5", "messages": [{"role": "user", "content": "Say hello in five words."}]}'--protocol also takes openai-responses and anthropic-messages. Use the model ID your project lists if it differs.
Put it in your backend
import OpenAI from "openai"
const ai = new OpenAI({
baseURL: "https://ai.alien.dev/v1",
apiKey: process.env.ALIEN_AI_API_KEY,
defaultHeaders: {
"X-Alien-External-ID": customer.id,
},
})
const response = await ai.chat.completions.create({
model: "byo/claude-opus-5",
messages: [{ role: "user", content: "Hello" }],
})Resolve customer.id from the signed-in account on your server, never from browser input.
If the request fails, search the gateway's request log. It records metadata, never prompts or responses:
alien logs --source ai-gateway --since 1h
alien logs --source ai-gateway --status provider-error --model byo/claude-opus-5Next
- Add to your product: the settings page and requests from your backend
- Requests and models: routing, protocols, logs, and usage
Overview
Run your product's AI requests on each customer's own model account, with their approved models, their terms, and their committed spend, from your hosted product or from inside their cloud.
Add to your product
Build an AI models settings page into a product you host. The customer connects their model provider; your backend calls it through the AI Gateway.