Give your agent a good starting point
Want an AI coding assistant to connect your app? Copy the prompt below into your assistant, or give it this page's Markdown URL. Ask your team administrator for an API key and put it in your application's secret manager; you do not need to paste the key into the prompt.
Copyable integration prompt
Integrate HyperQwen into this application using our existing architecture.
Read these references first:
https://qwenjon.voicelabs.uz/v1/docs/llms.md
https://qwenjon.voicelabs.uz/v1/docs/index.md
Connection:
- OpenAI-compatible base URL: https://qwenjon.voicelabs.uz/v1
- Model: qwen3.8-27b
- API key: read OPENAI_API_KEY from the backend's secret environment.
- Use our installed OpenAI SDK, or a compatible HTTP client.
- Never put the key in browser/mobile bundles, logs, commits, or examples.
Before changing code, inspect the app's current AI integration, conventions,
and authentication. Reuse the existing stack and keep the change focused.
Ask me only for missing product requirements or required credentials.
Implement:
1. Backend calls to POST /chat/completions, relative to the /v1 base URL.
2. A reasonable output limit (start at 2048), explicit timeout, and cancellation.
3. Streaming if the app supports it: parse SSE safely across network chunks.
Display delta.content as the answer; keep delta.reasoning separate.
Handle usage-only events and [DONE]. Do not count chunks as tokens.
4. Clear handling for invalid keys, long contexts, 429, network failures,
and output truncation. Bound retries and avoid duplicate side effects.
5. Use strict JSON schema and validate results when structured output is needed.
6. If tools are needed, validate and authorize allowlisted function proposals
in the host app. Bound the loop. Require appropriate confirmation for
consequential actions. Do not execute tools merely because the model asks.
7. Preserve the app's user authentication and access controls. Add application
limits if exposed to end users; the endpoint has one shared team credential.
Verify model discovery, a normal answer, streaming/cancellation if applicable,
and invalid-key/error behavior. Test the actual user workflow. Do not claim
unsupported features such as hosted browsing, embeddings, images, or audio.
Report changed files, configuration needed, tests run, and remaining limits.
The host is responsible for actions
HyperQwen can decide that a tool would help and return structured arguments. Your application supplies the tool implementation and controls access. A reasoning trace is model-generated text, not evidence that an external action happened.
A useful agent loop has a small tool allowlist, validated arguments, timeouts, a step budget, and clear records of actions and results. Keep user permissions separate from model instructions. Treat external documents and tool results as data; they cannot grant new permissions.
A complete, bounded tool example
This backend Python example uses a deliberately harmless local tool. It proposes a clock lookup, checks the function and arguments, returns the result, and asks the model for an answer. Replace it with your own authorized functions.
import json
from datetime import datetime
from zoneinfo import ZoneInfo
from openai import OpenAI
client = OpenAI(
base_url="https://qwenjon.voicelabs.uz/v1",
timeout=180,
max_retries=0,
)
model = "qwen3.8-27b"
tools = [{
"type": "function",
"function": {
"name": "current_time",
"description": "Get the current time in an allowed timezone.",
"parameters": {
"type": "object",
"properties": {
"timezone": {"type": "string", "enum": ["UTC", "Asia/Tashkent"]}
},
"required": ["timezone"],
"additionalProperties": False,
},
},
}]
messages = [{"role": "user", "content": "What time is it in Tashkent? Use the tool."}]
for step in range(4):
reply = client.chat.completions.create(
model=model, messages=messages, tools=tools,
tool_choice="auto", max_tokens=2048,
)
choice = reply.choices[0]
if choice.finish_reason == "length":
raise RuntimeError("Output budget reached; no tool was executed this turn")
message = choice.message
calls = message.tool_calls or []
if not calls:
if not message.content:
raise RuntimeError("Model returned no final answer")
print(message.content)
break
if len(calls) > 3:
raise RuntimeError("Too many tool calls in one turn")
# Store only the conversational assistant fields, not its reasoning trace.
messages.append({
"role": "assistant",
"content": message.content or "",
"tool_calls": [call.model_dump(exclude_none=True) for call in calls],
})
for call in calls:
if call.type != "function" or call.function.name != "current_time":
raise ValueError("Tool is not allowed")
args = json.loads(call.function.arguments)
if not isinstance(args, dict) or set(args) != {"timezone"}:
raise ValueError("Invalid tool arguments")
if args["timezone"] not in ("UTC", "Asia/Tashkent"):
raise ValueError("Timezone is not allowed")
result = {"time": datetime.now(ZoneInfo(args["timezone"])).isoformat()}
messages.append({
"role": "tool", "tool_call_id": call.id,
"content": json.dumps(result),
})
else:
raise RuntimeError("Agent step limit reached")
For real tools, validate the complete batch before performing any side effects. Apply your user's permissions, require approval when appropriate, use idempotency keys for writes, and cap result sizes. Never deserialize or run executable code from a tool proposal.
Integration acceptance checklist
- Model discovery returns
qwen3.8-27b; missing/wrong keys return 401. - The actual application can complete a representative task, including its target languages.
- Streaming handles split UTF-8, split events, empty choices, final usage, and cancellation.
- Reasoning and final text are separate. A partial or truncated answer is visibly marked.
- Structured results are schema-validated before use.
- Tool names, arguments, permissions, side effects, and step limits are enforced by the host.
- Secret values never appear in browser bundles or logs.
- Long history, 429, timeout, and network interruption have useful recovery paths.