Skip to content

Qwen Code

The qwen-code template ships Qwen Code preinstalled. It speaks the OpenAI-compatible API, so it works against DashScope, a self-hosted model, or any gateway that exposes that shape.

Setup

bash
pip install ovrin
export OVRIN_API_KEY="ovrin_..."

Run the agent

python
import ovrin

client = ovrin.Client()  # reads OVRIN_API_KEY

sandbox = client.sandboxes.create(
    template="qwen-code",
    env={
        "OPENAI_API_KEY": "...",
        "OPENAI_BASE_URL": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
        "OPENAI_MODEL": "qwen3-coder-plus",
    },
    timeout=1800,
)

result = sandbox.run('qwen -p "Compute 1+1 and explain it"')
print(result.stdout)

sandbox.kill()

Work on a repository

python
sandbox.files.write("/workspace/app.py", open("app.py").read())

result = sandbox.run(
    'cd /workspace && qwen -p "add type hints to app.py"',
    timeout=600,
)
print(sandbox.files.read("/workspace/app.py"))

Auth

VariablePurpose
OPENAI_API_KEYKey for the OpenAI-compatible endpoint
OPENAI_BASE_URLThe endpoint — DashScope, a gateway, or a local model
OPENAI_MODELModel name, for example qwen3-coder-plus

Because the endpoint is yours to choose, the sandbox's egress policy has to allow the host you point at.