Integration

Connect your SDK

Change two config values — api_key and base_url. Every other SDK feature (streaming, tool use, vision, model names) works unchanged.

Proxy base URLs

ProviderBase URL
OpenAIhttps://api.zelyx.app/proxy/openai/v1
Anthropichttps://api.zelyx.app/proxy/anthropic
Google (Gemini)https://api.zelyx.app/proxy/google
Groqhttps://api.zelyx.app/proxy/groq/openai/v1
Together AIhttps://api.zelyx.app/proxy/together/v1
Mistralhttps://api.zelyx.app/proxy/mistral/v1
DeepSeekhttps://api.zelyx.app/proxy/deepseek/v1
xAI (Grok)https://api.zelyx.app/proxy/xai/v1
OpenRouterhttps://api.zelyx.app/proxy/openrouter/api/v1
Fireworkshttps://api.zelyx.app/proxy/fireworks/inference/v1
Perplexityhttps://api.zelyx.app/proxy/perplexity/v1
NoteGroq, Together, Mistral, DeepSeek, xAI, OpenRouter, Fireworks, and Perplexity all use the OpenAI-compatible API format. Use the OpenAI SDK with the matching base URL.

OpenAI SDK — Python

python
from openai import OpenAI

client = OpenAI(
    api_key="nk_<your-zelyx-key>",
    base_url="https://api.zelyx.app/proxy/openai/v1",
)

# Non-streaming
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Summarise this report"}],
)
print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Summarise this report"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)

OpenAI SDK — TypeScript

typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "nk_<your-zelyx-key>",
  baseURL: "https://api.zelyx.app/proxy/openai/v1",
});

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

// Streaming
const stream = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello" }],
  stream: true,
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}

Anthropic SDK — Python

python
import anthropic

client = anthropic.Anthropic(
    api_key="nk_<your-zelyx-key>",
    base_url="https://api.zelyx.app/proxy/anthropic",
)

# Non-streaming
message = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)

# Streaming
with client.messages.stream(
    model="claude-haiku-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

# With tagging headers
message = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Review this code"}],
    extra_headers={
        "X-Zelyx-Team": "backend",
        "X-Zelyx-Project": "code-review",
    },
)
NoteThe Anthropic SDK sends the key as x-api-key. Zelyx accepts both x-api-key and Authorization: Bearer — no extra config needed.

Google (Gemini) — Python

python
from openai import OpenAI  # Gemini uses the OpenAI-compatible endpoint

client = OpenAI(
    api_key="nk_<your-zelyx-key>",
    base_url="https://api.zelyx.app/proxy/google",
)

response = client.chat.completions.create(
    model="gemini-2.0-flash",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

Groq / Together / Mistral — Python

All providers that use the OpenAI-compatible format work the same way — just swap the base_url.

python
from openai import OpenAI

# Groq
client = OpenAI(
    api_key="nk_<your-zelyx-key>",
    base_url="https://api.zelyx.app/proxy/groq/openai/v1",
)

response = client.chat.completions.create(
    model="llama-3.1-70b-versatile",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)

Reading environment variables

Store your Zelyx key in an environment variable rather than hardcoding it. The OpenAI SDK reads OPENAI_API_KEY and OPENAI_BASE_URL automatically.

bash
# .env
OPENAI_API_KEY=nk_<your-zelyx-key>
OPENAI_BASE_URL=https://api.zelyx.app/proxy/openai/v1
python
from openai import OpenAI

# Reads OPENAI_API_KEY and OPENAI_BASE_URL from environment automatically
client = OpenAI()

Tool use & function calling

Tool use works without any changes. Pass tools exactly as you would with the provider SDK. Zelyx records tool names in the cost event and uses them for payment-risk analysis in the gate.

python
tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get current weather",
            "parameters": {
                "type": "object",
                "properties": {"location": {"type": "string"}},
                "required": ["location"],
            },
        },
    }
]

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "What's the weather in London?"}],
    tools=tools,
)