Zyora Labs
Z-AI / Quickstart

Quickstart

From zero to your first streaming completion in five minutes.

1. Create a Z-AI API key

Open Z-AI → API keys and click New key. You'll see the full key once — copy it. It looks like:

bash
zk_live_0PkUgcmnihXNZrPmuDVE6BsZEsk_...

Keep this secret. Treat it like a password. You can rotate it any time; old keys can be revoked instantly.

2. Connect a provider (BYOK)

Z-AI sends requests to upstream providers using YOUR keys, never ours. You pay your provider directly.

In Z-AI → Providers, paste your provider key (e.g. sk-… for OpenAI). It is encrypted at rest using a Fernet key that never leaves the server.

You need at least one provider configured to make calls. Each provider unlocks the corresponding models in the catalog.

3. Your first request (curl)
bash
curl https://api.zyoralabs.com/v1/chat/completions \
  -H "Authorization: Bearer $ZAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.4-mini",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "Say hello in one word."}
    ]
  }'

For local dev, replace the URL with http://127.0.0.1:8011/v1.

4. Streaming
bash
curl https://api.zyoralabs.com/v1/chat/completions \
  -H "Authorization: Bearer $ZAI_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{
    "model": "anthropic/claude-4.5-sonnet",
    "messages": [{"role":"user","content":"Stream this please."}],
    "stream": true
  }'

Standard server-sent events. Each data: line contains a delta. data: [DONE] ends the stream.

5. With the OpenAI SDK
ts
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ZAI_KEY!,
  baseURL: "https://api.zyoralabs.com/v1",
});

const res = await client.chat.completions.create({
  model: "openai/gpt-5.4-mini",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(res.choices[0].message.content);

Same SDK, same shape — just swap baseURL and apiKey. Works in Python, JS, Go, Ruby — anywhere the OpenAI SDK exists.

6. Python SDK
bash
pip install openai
ts
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ZAI_KEY"],
    base_url="https://api.zyoralabs.com/v1",
)

res = client.chat.completions.create(
    model="anthropic/claude-4.5-sonnet",
    messages=[{"role": "user", "content": "Hello"}],
)
print(res.choices[0].message.content)