AI Coding Agents
Full OpenAI compatibility for Kilo Code, Cline, Cursor, and custom agents: content-part arrays, tool history, and streaming usage.
Private 27B GPU inference behind a clean OpenAI-compatible HTTPS API — tuned for Kilo Code, Cline, tool calling, and streaming.
Checking gateway…
{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"choices": [{
"message": {
"role": "assistant",
"content": "Ready when you are."
}
}]
}This deployment serves qwen3.8-27B-14GB-IQ4:latest (Qwen3.5 architecture, ~27B, IQ4_XS) on a private GPU. Ollama reports native support for completion, thinking, and tools.
Full OpenAI compatibility for Kilo Code, Cline, Cursor, and custom agents: content-part arrays, tool history, and streaming usage.
Multi-turn chat, coding, Persian & English, system prompts, structured JSON output, and long-form answers.
Low-latency token streaming via stream: true and stream_options.include_usage.
Per-request reasoning mode returning reasoning_content and reasoning alongside final content.
OpenAI-style tools, tool_choice, and multi-turn tool_call_id state mapping.
No vision weights. Do not send image URLs or base64 image parts — requests with images return 400.
Public chat-completions has no server-side search tools. Agents supply their own client-side tools.
/v1/embeddings is not proxied on this endpoint. Use chat completions only.
Use https://api.qwenlab.ir/v1 (include /v1).
Header Authorization: Bearer YOUR_API_KEY or X-API-Key: YOUR_API_KEY. Never publish real keys.
qwen3.8-27B-14GB-IQ4:latest
Select OpenAI Compatible in Kilo Code, Cline, or your SDK and point it to /v1.
BASE_URL=https://api.qwenlab.ir/v1
API_KEY=YOUR_API_KEY
MODEL=qwen3.8-27B-14GB-IQ4:latest
Only these paths are reverse-proxied to the inference gateway. All other paths serve static docs or return 404.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /health |
No | Gateway liveness & capabilities |
| GET | /v1/models |
Yes | List available models |
| POST | /v1/chat/completions |
Yes | Chat / code / tools (stream & non-stream) |
Standard OpenAI chat format: an array of messages with roles
system, developer, user, assistant, and tool.
Both string and array content parts are supported.
{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [
{ "role": "system", "content": "You are a precise coding assistant." },
{ "role": "user", "content": "Write a typed Python palindrome helper." }
],
"temperature": 0.2,
"max_tokens": 400,
"stream": false
}
assistant replies and tool responses to messages to keep conversation state on the client.
The API is stateless.
Set "stream": true. The response is text/event-stream with OpenAI-style data: chunks, optional final usage, and [DONE].
curl -N https://api.qwenlab.ir/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [{"role":"user","content":"Outline a REST error taxonomy."}],
"stream": true,
"stream_options": {"include_usage": true},
"max_tokens": 250
}'
This model supports a thinking mode. Turn it on or off per request
with OpenAI-compatible fields. Server default is off (OPENAI_THINK=false) for fast coding turns.
true / false — direct switch (recommended).
Alias of think.
none → off. minimal | low | medium | high | xhigh → on.
Nested bool sent by some Qwen clients.
When thinking is on, responses and stream deltas include reasoning_content and reasoning alongside content.
{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [{ "role": "user", "content": "Say OK" }],
"think": false,
"max_tokens": 256
}
{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [{ "role": "user", "content": "Plan a safe DB migration." }],
"reasoning_effort": "high",
"max_tokens": 2048
}
Pass OpenAI-compatible tools and tool_choice.
When the model returns tool_calls, execute them in your agent and reply with a tool role message matching tool_call_id.
{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [
{ "role": "user", "content": "Convert 72 F to Celsius using the tool." }
],
"tools": [{
"type": "function",
"function": {
"name": "fahrenheit_to_celsius",
"description": "Convert °F to °C",
"parameters": {
"type": "object",
"properties": {
"f": { "type": "number" }
},
"required": ["f"]
}
}
}]
}
Model ID: qwen3.8-27B-14GB-IQ4:latest.
Conversation turns. Supports string or OpenAI content-part arrays.
true for SSE; false for a single JSON object.
Pass {"include_usage": true} to receive token counts in SSE.
false / none by default; enable per request for deep reasoning.
Lower (0–0.3) for coding & tool use; higher for creative drafting.
Cap on generated tokens. Defaults to 8192 when omitted.
Supports json_object and json_schema.
Function schemas and choice control (auto, none, or specific function).
num_ctx is tuned for the 16 GB GPU (24576 tokens by default). Clients may override via options.num_ctx.
curl -sS https://api.qwenlab.ir/health
curl -sS https://api.qwenlab.ir/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
curl -sS https://api.qwenlab.ir/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.8-27B-14GB-IQ4:latest",
"messages": [{"role":"user","content":"SSD را در سه جمله توضیح بده."}],
"stream": false,
"max_tokens": 300
}'
from openai import OpenAI
client = OpenAI(
base_url="https://api.qwenlab.ir/v1",
api_key="YOUR_API_KEY",
)
resp = client.chat.completions.create(
model="qwen3.8-27B-14GB-IQ4:latest",
messages=[{"role": "user", "content": "Summarize TCP handshake."}],
stream=False,
extra_body={"think": False},
)
print(resp.choices[0].message.content)
Choose the OpenAI Compatible provider in extension settings. Supports streaming, tool calling, and token usage tracking.
OpenAI-compatible connector. Pass thinking flags per request if deep reasoning is needed.
Point any standard OpenAI SDK client at this HTTPS base URL with Bearer or X-API-Key auth.
This is a personal GPU relay hosted through an encrypted reverse tunnel to Iran edge infrastructure.
The origin PC must be online with the gateway and tunnel healthy. Invalid keys return 401.
If the local GPU is momentarily busy with a background job, chat requests wait up to 30 seconds in queue and return 429 with Retry-After if still occupied.
YOUR_API_KEY).
Need an API key or integration help for Kilo Code, Cline, or your own client? Reach out with your project details and expected usage.
Personal contact for Qwenlab AI API access and integration support.
software.eng.maleki@gmail.com