Skip to content

Kimi CLI

The kimi-cli template ships Moonshot's Kimi Code CLI preinstalled.

TIP

Kimi CLI is a Python package rather than an npm one, and it needs Python 3.12. The template handles that — it is the only difference you would notice.

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="kimi-cli",
    env={"KIMI_API_KEY": "..."},
    timeout=1800,
)

result = sandbox.run('kimi -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 && kimi -p "write tests for app.py"',
    timeout=600,
)
print(sandbox.files.read("/workspace/app.py"))

Auth

VariablePurpose
KIMI_API_KEYMoonshot API key
KIMI_BASE_URLPoint at a proxy or gateway
KIMI_MODEL_NAMEOverride the default model