Code Examples

Code Examples

Examples target /v1/chat/completions. Replace <model-id> with a model from GET /v1/models.

cURL — Non-thinking (Default)

curl -L -X POST https://umva.net/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${UMVA_API_KEY}" \
-d '{
"model": "<model-id>",
"messages": [
{"content": "You are a helpful assistant", "role": "system"},
{"content": "Hi", "role": "user"}
],
"max_tokens": 4096,
"response_format": {"type": "text"},
"stop": null,
"stream": false,
"stream_options": null,
"temperature": 1,
"top_p": 1,
"tools": null,
"tool_choice": "none",
"logprobs": false,
"top_logprobs": null
}'

cURL — With Thinking

curl -L -X POST https://umva.net/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${UMVA_API_KEY}" \
-d '{
"model": "<model-id>",
"messages": [
{"content": "You are a helpful assistant", "role": "system"},
{"content": "Solve a complex problem", "role": "user"}
],
"thinking": {"type": "enabled"},
"reasoning_effort": "high",
"max_tokens": 4096,
"response_format": {"type": "text"},
"stop": null,
"stream": false,
"stream_options": null,
"temperature": 1,
"top_p": 1,
"tools": null,
"tool_choice": "none",
"logprobs": false,
"top_logprobs": null
}'

Python (OpenAI SDK)

from openai import OpenAI
client = OpenAI(
base_url="https://umva.net",
api_key=umva_ai_YOUR_API_KEY_HERE
)
# Non-thinking (default)
response = client.chat.completions.create(
model="<model-id>",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
# With thinking
response = client.chat.completions.create(
model="<model-id>",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Solve this step by step"}
],
extra_body={
"thinking": {"type": "enabled"},
"reasoning_effort": "high"
}
)
print(response.choices[0].message.content)

Node.js (OpenAI SDK)

import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://umva.net",
apiKey: "umva_ai_YOUR_API_KEY_HERE"
});
// Non-thinking (default)
const res = await client.chat.completions.create({
model: "<model-id>",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello!" }
]
});
console.log(res.choices[0].message.content);
// With thinking
const res2 = await client.chat.completions.create({
model: "<model-id>",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Solve this step by step" }
],
thinking: { type: "enabled" },
reasoning_effort: "high"
});
console.log(res2.choices[0].message.content);

Python (Anthropic SDK)

from anthropic import Anthropic
client = Anthropic(
base_url="https://umva.net",
api_key=umva_ai_YOUR_API_KEY_HERE
)
# Non-thinking (default)
response = client.messages.create(
model="<model-id>",
max_tokens=4096,
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)
# With thinking
response = client.messages.create(
model="<model-id>",
max_tokens=8192,
thinking={"type": "enabled", "budget_tokens": 4096},
messages=[{"role": "user", "content": "Walk through the solution"}]
)
for block in response.content:
if block.type == "thinking":
print(f"Thinking: {block.thinking}")
elif block.type == "text":
print(f"Answer: {block.text}")

Node.js (Anthropic SDK)

import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://umva.net",
apiKey: "umva_ai_YOUR_API_KEY_HERE"
});
// Non-thinking (default)
const res = await client.messages.create({
model: "<model-id>",
max_tokens: 4096,
messages: [{ role: "user", content: "Hello!" }]
});
console.log(res.content[0].text);
// With thinking
const res2 = await client.messages.create({
model: "<model-id>",
max_tokens: 8192,
thinking: { type: "enabled", budget_tokens: 4096 },
messages: [{ role: "user", content: "Walk through the solution" }]
});
for (const block of res2.content) {
if (block.type === "thinking") console.log("Thinking:", block.thinking);
else if (block.type === "text") console.log("Answer:", block.text);
}

List Models

curl https://umva.net/v1/models \
-H "Authorization: Bearer ${UMVA_API_KEY}"