Code Examples

Get started with your preferred language

Python (requests)

import requests

url = "https://umva.net/api/llm/completion"
headers = {
    "Authorization": "Bearer umva_ai_YOUR_KEY",
    "Content-Type": "application/json",
    "User-Agent": "umva-ai-editor/1.0",
    "X-Request-Id": "your-uuid-here",
}
data = {
    "model": "umva-code-fast",
    "max_tokens": 200,
    "messages": [
        {"role": "user",
         "content": "Write a Python sort function"}
    ],
    "stream": True
}
r = requests.post(url, json=data,
    headers=headers, stream=True)
for line in r.iter_lines():
    if line:
        print(line.decode())

Node.js (fetch)

const response = await fetch(
  "https://umva.net/api/llm/completion",
  {
    method: "POST",
    headers: {
      "Authorization":
        "Bearer umva_ai_YOUR_KEY",
      "Content-Type":
        "application/json",
      "User-Agent":
        "umva-ai-editor/1.0",
      "X-Request-Id":
        crypto.randomUUID(),
    },
    body: JSON.stringify({
      model: "umva-code-fast",
      max_tokens: 200,
      messages: [
        {role: "user",
         content: "Write a Python sort function"}
      ],
      stream: true,
    }),
  }
);
const reader = response.body
  .getReader();
// process SSE stream...

cURL (Streaming)

curl -N -X POST https://umva.net/api/llm/completion \
  -H "Authorization: Bearer umva_ai_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "User-Agent: umva-ai-editor/1.0" \
  -H "X-Request-Id: $(uuidgen)" \
  -d '{
    "model": "umva-code-fast",
    "max_tokens": 200,
    "messages": [
      {"role": "user", "content": "Write a Python sort function"}
    ],
    "stream": true
  }'

List Models (cURL)

curl https://umva.net/api/llm/models \
  -H "Authorization: Bearer umva_ai_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Version: 1.0" \
  -H "User-Agent: umva-ai-editor/1.0"

Returns JSON with all available models, capabilities, context window, and max output tokens.