SDK snippets
Replace YOUR_ZEALLM_KEY with a revealed virtual key and gpt-4o-mini with a model your key can access. Default base URL: http://localhost:8080/v1.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_ZEALLM_KEY",
base_url="http://localhost:8080/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello from ZeaLLM"}],
)
print(resp.choices[0].message.content)
Node.js (OpenAI SDK)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.ZEALLM_API_KEY,
baseURL: "http://localhost:8080/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello from ZeaLLM" }],
});
console.log(resp.choices[0]?.message?.content);
cURL
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer YOUR_ZEALLM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role":"user","content":"Hello from ZeaLLM"}]
}'
Customer and tag attribution
curl http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer YOUR_ZEALLM_KEY" \
-H "x-zeallm-customer-id: end-user-123" \
-H "x-zeallm-tags: cost-center-42,experiment-a" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"Hi"}]}'
Supported operations: chat completions (streaming and non-streaming), embeddings, model listing. See first request.