Chat / LLM with Velqa — OpenAI-compatible API payable in MAD
Velqa's chat API follows the OpenAI POST /v1/chat/completions format exactly. To use it from existing code, just change the `base_url` to https://api.velqa.dev/v1 and use your sk-... key. You pay in dirhams, no international card required.
Minimal request (curl)
curl https://api.velqa.dev/v1/chat/completions \
-H "Authorization: Bearer sk-..." \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.6",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain RAG in one sentence."}
],
"max_tokens": 200
}'Minimal request (Python, openai SDK)
from openai import OpenAI
client = OpenAI(base_url="https://api.velqa.dev/v1", api_key="sk-...")
resp = client.chat.completions.create(
model="kimi-k2.6",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain RAG in one sentence."},
],
max_tokens=200,
)
print(resp.choices[0].message.content)Request shape
model— the model ID (see models) orvelqa-autoto let Velqa choose (see auto-router).messages— the conversation, a list of{"role": ..., "content": ...}objects. Roles aresystem,user,assistant(andtoolfor tool calling).max_tokens— caps the number of generated output tokens. Useful to control cost and avoid exceeding the context window of a small-context model.temperature,top_p,stop… — the usual OpenAI parameters are supported.
Response shape
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "kimi-k2.6",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "..."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 42, "completion_tokens": 18, "total_tokens": 60}
}The generated text is in choices[0].message.content. The usage field reports the billed tokens (input + output).
Choosing a model
- Fast and cheap:
glm-4.7-flash,deepseek-v4-flash. - Coding and agentic:
kimi-k2.6,minimax-m3,glm-5.2,deepseek-v4-pro,qwen3.7-max. - Don't want to choose? Use
velqa-auto.
Advanced coding models require a Dev plan or higher. See models and plans.
Going further
- Streaming responses — receive text as it's generated (SSE).
- Tool calling / function calling — let the model call your functions.
- velqa-auto model — automatic routing based on your plan.
