Docs

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-5

Every 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-5

Create 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-quickstart

The 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 models

Open 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-5

Run 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

lib/ai.ts
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-5

Next

On this page