Chat Completions
Generate model responses from a list of messages. The core Tolka Edge endpoint, fully OpenAI-compatible with streaming support.
Create a model response for a conversation using your dedicated AI Rig. This is Tolka Edge's primary endpoint and mirrors the OpenAI Chat Completions contract exactly.
POST
https://api.tolkaedge.com/v1/chat/completionsHeaders
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer tk-live-... |
Content-Type | Yes | application/json |
Request body
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Model slug to route to. Currently supported: Qwen/Qwen3-14B. |
messagesrequired | array | The conversation so far. Each item has a role (system, user, assistant) and content. |
stream | boolean | Stream partial deltas as server-sent events.Default: false |
temperature | number | Sampling temperature between 0 and 2. Higher is more random.Default: 1 |
max_tokens | integer | Maximum number of tokens to generate in the completion. |
Tolka Edge forwards standard OpenAI fields directly to the vLLM instance running on your AI Rig. Advanced payload fields are passed through verbatim.
Message object
| Parameter | Type | Description |
|---|---|---|
rolerequired | string | One of system, user, or assistant. |
contentrequired | string | The message text. |
Request example
from openai import OpenAI
import os
client = OpenAI(
base_url="https://api.tolkaedge.com/v1",
api_key=os.environ.get("TOLKA_API_KEY"),
)
resp = client.chat.completions.create(
model="Qwen/Qwen3-14B",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain dedicated GPU inference."},
],
temperature=0.7,
max_tokens=256,
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.tolkaedge.com/v1", apiKey: process.env.TOLKA_API_KEY });
const resp = await client.chat.completions.create({
model: "Qwen/Qwen3-14B",
messages: [
{ role: "system", content: "You are a concise assistant." },
{ role: "user", content: "Explain dedicated GPU inference." },
],
temperature: 0.7,
max_tokens: 256,
});
console.log(resp.choices[0].message.content);curl https://api.tolkaedge.com/v1/chat/completions \
-H "Authorization: Bearer $TOLKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen3-14B",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain dedicated GPU inference."}
],
"temperature": 0.7,
"max_tokens": 256
}'Response
{
"id": "chatcmpl-9f2b...",
"object": "chat.completion",
"created": 1716492000,
"model": "Qwen/Qwen3-14B",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Dedicated GPU inference means running your AI models on isolated hardware, ensuring you don't share compute or memory with other users, which guarantees privacy and consistent latency."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 30,
"total_tokens": 44
}
}Tolka Edge Headers
Every response includes custom headers for cost and debugging:
| Header | Example | Description |
|---|---|---|
X-Tolka-Cost-INR | 0.0000 | The exact cost billed to your wallet in paise. |
X-Tolka-Model-Used | Qwen/Qwen3-14B | The model slug that was used. |
X-Tolka-Provider-Used | runpod | The cloud provider hosting your dedicated AI Rig. |