Quick Start
Get ZIRI running and make your first request in about five minutes.
Prerequisites
- Docker and Docker Compose installed
- An OpenAI API key (or Anthropic, for testing)
Step 1: Start ZIRI
Create a docker-compose.yml file:
services:
proxy:
image: ziri/proxy:latest
ports:
- "3100:3100"
volumes:
- ziri-data:/data
environment:
- CONFIG_DIR=/data
- PORT=3100
- HOST=0.0.0.0
restart: unless-stopped
volumes:
ziri-data:Start ZIRI:
docker compose up -dOn first run, ZIRI generates a root key and stores it in the config directory as .ziri-root-key.
With the example docker-compose.yml (which sets CONFIG_DIR=/data), the file lives at /data/.ziri-root-key inside the container. You can read it like this:
docker compose exec proxy cat /data/.ziri-root-keyImportant: Save the root key. You’ll need it to log into the admin UI as the initial ziri admin.
Step 2: Access the Admin UI
Open http://localhost:3100 in your browser. You’ll be redirected to the login page.
Log in with:
- Username / Email:
ziriorziri@ziri.local - Password: The root key from Step 1 (or the value of
ZIRI_ROOT_KEYif you set it)
Step 3: Configure a Provider
Before making requests, you need to add a provider API key:
- Click Providers in the sidebar
- Click Add Provider
- Fill in:
- Name:
openai - Display Name:
OpenAI - API Key: Your OpenAI API key
- Name:
- Click Save
Step 4: Create a User
Create a user to get an API key:
- Click Users in the sidebar
- Click Create User
- Fill in:
- Email:
test@example.com - Name:
Test User - Tenant:
engineering(optional) - Role:
analyst(optional) - Create API Key: enabled
- Email:
- Click Create User
When Create API Key is enabled, ZIRI creates and returns a key for the new user.
Step 5: Get the API Key
- Click Keys in the sidebar
- Find the key for your user
- Click on it to view details
- Copy the API key (format:
ziri-user-123-a1b2c3d4e5f67890)
Note: The key is only shown once. If you lose it, you’ll need to rotate it (which creates a new key and deletes the old one).
Step 6: Create a Policy
By default, no requests are allowed. Create a simple policy:
- Click Rules in the sidebar
- Click Create Rule
- Use a template or write your own:
permit (
principal,
action == Action::"completion",
resource
)
when {
principal.status == "active"
};This allows any active user key to make completion requests.
- Add a description: “Allow completions for active keys”
- Click Create
Step 7: Make Your First Request
Now test it with curl:
curl -X POST http://localhost:3100/api/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: ziri-your-user-id-your-key-hash" \
-d '{
"provider": "openai",
"model": "gpt-4o-mini",
"messages": [
{"role": "user", "content": "Hello, ZIRI!"}
]
}'Replace ziri-your-user-id-your-key-hash with your actual API key from Step 5.
You should get a response from OpenAI, routed through ZIRI.
Using the SDK
Instead of curl, use the SDK in your code:
npm install @ziri/sdkimport { UserSDK } from "@ziri/sdk";
const sdk = new UserSDK({
apiKey: "ziri-your-user-id-your-key-hash",
proxyUrl: "http://localhost:3100",
});
const response = await sdk.chatCompletions({
provider: "openai",
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello, ZIRI!" }],
});
console.log(response.choices[0].message.content);See the SDK documentation for more details.
Common First-Time Issues
“Authorization denied” - Check that you created a policy and it’s active. Default policies deny everything.
“API key not found” - Make sure you’re using the correct API key format: ziri-{userId}-{hash}.
“Provider not found” - Add the provider in the UI first (Step 3).
“Rate limit exceeded” - You’ve hit the default rate limit. Check the user’s rate limit settings.
Port already in use - Change the port in docker-compose.yml or stop the other process.
Next Steps
- Read the API Reference for all available endpoints
- Check out Policy Examples for more complex policies
- See Configuration for advanced setup