The AI-Native Cloud for builders and agents: run models, scale GPUs, and build AI agents on one platform.
This file is the agent route. It must work when installed as a skill and when read directly from:
https://raw.githubusercontent.com/novitalabs/novita-skills/main/skills/novita-ai/SKILL.md
Rules
- Use
NOVITA_API_KEY; never paste secrets into source or answers. - Use
NOVITA_MODELor the model already selected by the user/application. - Do not recommend or invent a default model. If none is selected, list models or ask the user to choose.
- Verify dynamic data live before giving hard values: models, pricing, rate limits, quota, latency, GPU inventory, and sandbox limits.
- Pick one route first. Read more than one reference only when the task spans products.
- In raw-read mode, fetch the matching raw reference URL from the route table.
- Return runnable code or commands with explicit placeholders such as
<MODEL_NAME>,<TASK_ID>, and<INPUT_FILE>. - Use trusted local media files for image, video, and audio inputs unless the user explicitly provides a safe URL.
Constants
| Item | Value |
|---|---|
| API base | https://api.novita.ai |
| OpenAI-compatible base | https://api.novita.ai/openai |
| OpenAI-compatible v1 base | https://api.novita.ai/openai/v1 |
| API key | NOVITA_API_KEY |
| Model | NOVITA_MODEL |
| Model catalog | https://novita.ai/models |
| Pricing | https://novita.ai/pricing |
| Console | https://novita.ai/console |
| API keys | https://novita.ai/settings/key-management |
Route Table
Model Selection
Use this order:
- User-provided model.
- Existing project config or
NOVITA_MODEL. - Live catalog query, then ask the user or choose only when the user gave selection criteria.
curl https://api.novita.ai/openai/v1/models \
-H "Authorization: Bearer $NOVITA_API_KEY"
Minimal LLM Call
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.novita.ai/openai",
api_key=os.environ["NOVITA_API_KEY"],
)
response = client.chat.completions.create(
model=os.environ["NOVITA_MODEL"],
messages=[{"role": "user", "content": "Hello"}],
max_tokens=512,
)
print(response.choices[0].message.content)
curl https://api.novita.ai/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $NOVITA_API_KEY" \
-d '{
"model": "'"$NOVITA_MODEL"'",
"messages": [{"role": "user", "content": "Hello"}],
"max_tokens": 512
}'
Async Tasks
Image and video APIs often return task_id. Poll results:
curl "https://api.novita.ai/v3/async/task-result?task_id=<TASK_ID>" \
-H "Authorization: Bearer $NOVITA_API_KEY"
Agent Sandbox
Use Sandbox for isolated code execution, file operations, templates, long-running agent environments, and E2B-compatible workflows. Handle common Sandbox tasks here; use novita-sandbox only for deeper CLI detail.
SDK Baseline
pip install novita-sandbox
export NOVITA_API_KEY=<YOUR_API_KEY>
from novita_sandbox.code_interpreter import Sandbox
sandbox = Sandbox.create()
execution = sandbox.run_code("print('hello world')")
print(execution.logs)
sandbox.kill()
Generate JavaScript/TypeScript equivalents when the user is working in Node.js.
CLI Baseline
Check Node.js and install or update the CLI:
if ! command -v node >/dev/null 2>&1; then
echo "Install Node.js first"
elif ! command -v novita-sandbox-cli >/dev/null 2>&1; then
npm install -g novita-sandbox-cli@beta
else
novita-sandbox-cli --version
fi
Authenticate when needed:
novita-sandbox-cli auth info || novita-sandbox-cli auth login
CLI Workflows
# Template
novita-sandbox-cli template init
novita-sandbox-cli template build -n <TEMPLATE_NAME>
novita-sandbox-cli template list
# Sandbox lifecycle. Use --detach inside AI agents; interactive terminals usually fail there.
novita-sandbox-cli sandbox create <TEMPLATE_ID> --detach
novita-sandbox-cli sandbox list
novita-sandbox-cli sandbox logs <SANDBOX_ID> -f
novita-sandbox-cli sandbox metrics <SANDBOX_ID> -f
novita-sandbox-cli sandbox clone <SANDBOX_ID> --count <N>
novita-sandbox-cli sandbox commit <SANDBOX_ID> --alias <ALIAS>
novita-sandbox-cli sandbox kill <SANDBOX_ID>
# Deploy and invoke an agent. Pass env vars explicitly; sandbox processes do not inherit local shell env.
novita-sandbox-cli agent configure -n <AGENT_NAME> -e <ENTRYPOINT>
novita-sandbox-cli agent launch
novita-sandbox-cli agent invoke '{"prompt":"hello"}' --stream --env NOVITA_API_KEY=$NOVITA_API_KEY
For exact flags, template versioning, E2B compatibility, pricing, and quota behavior, read the Sandbox route in the table above.
Error Defaults
401/403: check key, account status, andAuthorization: Bearer ....404/ model not found: verify exact model ID from the live catalog.429: reduce concurrency, back off, inspect rate limits and account tier.- Insufficient credits: check billing and balance.
- Long-running media: use async polling or webhooks.