Integration Guide
This guide integrates Qevron into your application from scratch, step by step: from setup to your first call, then to a production-ready configuration. You can follow it without skipping any step.
Prerequisites
Before you start, you should have:
| Requirement | Description |
|---|---|
| Qevron API key | A key starting with sk-. If you don't have one, create it from Authentication. |
| A programming language | This guide has Python and JavaScript examples. You can also follow along language-agnostically with curl. |
| Basic terminal knowledge | Running commands, setting environment variables. |
The base URL is the same in every example: https://app.qevron.ai/v1
Step 1 — Get and store the key securely
An API key is like a password. Never put it in source code; store it in an environment variable.
export QEVRON_API_KEY="sk-..."$Env:QEVRON_API_KEY = "sk-..."# .env (add this file to .gitignore!)
QEVRON_API_KEY=sk-...WARNING
Don't put the key on the client side (browser/mobile app) — anyone can read it. Always proxy requests through your own server (see Step 7).
Step 2 — Install the SDK
Because Qevron is OpenAI-compatible, you use the official openai SDK.
pip install openainpm install openaiIf you use curl, no installation is needed.
Step 3 — Configure the client
The only difference is base_url: point it at Qevron instead of OpenAI.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["QEVRON_API_KEY"],
base_url="https://app.qevron.ai/v1",
)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.QEVRON_API_KEY,
baseURL: "https://app.qevron.ai/v1",
});Step 4 — First call and reading the response
resp = client.chat.completions.create(
model="verinova",
messages=[{"role": "user", "content": "Hello! Introduce yourself in one sentence."}],
)
print(resp.choices[0].message.content) # reply text
print(resp.usage.total_tokens) # tokens spentconst resp = await client.chat.completions.create({
model: "verinova",
messages: [{ role: "user", content: "Hello! Introduce yourself in one sentence." }],
});
console.log(resp.choices[0].message.content);
console.log(resp.usage.total_tokens);curl https://app.qevron.ai/v1/chat/completions \
-H "Authorization: Bearer $QEVRON_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"verinova","messages":[{"role":"user","content":"Hello!"}]}'The reply text is in choices[0].message.content, usage info is in usage. To see which models are available, use /v1/models.
Step 5 — Add streaming
For chat UIs, show the response word by word:
stream = client.chat.completions.create(
model="verinova",
messages=[{"role": "user", "content": "Explain RAG in three bullet points."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="", flush=True)const stream = await client.chat.completions.create({
model: "verinova",
messages: [{ role: "user", content: "Explain RAG in three bullet points." }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0].delta.content ?? "");
}Details: Streaming.
Step 6 — Error handling and retries
Qevron does automatic failover at the channel level (if one provider goes down it switches to another). Still, it's good practice to retry transient errors (429, 5xx) on the client side with exponential backoff.
import time
from openai import OpenAI, APIStatusError, APIConnectionError
client = OpenAI(api_key=os.environ["QEVRON_API_KEY"], base_url="https://app.qevron.ai/v1")
def chat_with_retry(messages, model="verinova", max_retries=4):
for attempt in range(max_retries):
try:
return client.chat.completions.create(model=model, messages=messages)
except APIStatusError as e:
# 429 (rate limit) and 5xx are retryable; 4xx (e.g. 401/404) are not
if e.status_code in (429, 500, 502, 503) and attempt < max_retries - 1:
time.sleep(2 ** attempt) # 1s, 2s, 4s, 8s
continue
raise
except APIConnectionError:
if attempt < max_retries - 1:
time.sleep(2 ** attempt)
continue
raise
print(chat_with_retry([{"role": "user", "content": "hi"}]).choices[0].message.content)Full list of error codes: Errors.
Step 7 — Production checklist
Before going live:
- [ ] Keep the key on the server. Don't call directly from browser/mobile; proxy the request through your own backend.
- [ ] Secret management. Store the key in an environment variable / secret manager, never commit it.
- [ ] Make model selection dynamic. Instead of hardcoding model names, verify available ones with
/v1/models. - [ ] Monitor rate limits. Track the
X-RateLimit-*values in response headers and slow down if needed (see API Keys & Quota). - [ ] Add retry logic (Step 6).
- [ ] Track usage. Monitor cost with the
usagefield in each response or the billing endpoints. - [ ] Set timeouts. Give a reasonable timeout for long requests (image/video).
For AI agents and tools
You can reach all of this documentation as raw markdown, without rendering — to feed it to an AI assistant or IDE:
# A single page: append .md to the URL
curl https://docs.qevron.ai/en/api/chat.md
# All docs in one file
curl https://docs.qevron.ai/llms-full.txtDetails: API Overview — Raw markdown access.