Kopro API Documentation v1.5
Chat App Studio Sandbox Get API Key

Kopro API Quickstart

Connect your applications directly to Kopro AI using standard HTTP POST requests. Works out of the box with Python requests, JavaScript fetch, or curl.

Authentication & Keys

All API requests must include your personal Kopro API Key in the Authorization header:

Authorization: Bearer kp_live_... (or x-api-key: kp_live_...)

Generate your live API key anytime from Settings → Developer API Key on kopro.mom.

Available Models

Model ID Parameters Speed Best For
kopro-1.5 3 Billion Fast Flagship deep reasoning, code generation, prose, and structured output
kopro-flash 1.2 Billion Sub-second Real-time chat, summarization, high-throughput workers
kopro-1.0 1.5 Billion Fast Classic Kopro personality & light dialogue tasks

Stateless Conversations

Maintain full control over conversation state by managing the messages array on your client side and appending new user and assistant turns:

import requests

url = "https://api.kopro.mom/v1/chat/completions"
headers = {
    "Authorization": "Bearer kp_live_your_api_key",
    "Content-Type": "application/json"
}

history = [
    {"role": "user", "content": "I have 2 dogs in my house."},
    {"role": "assistant", "content": "That's lovely! What breeds are they?"}
]

# Append new turn
history.append({"role": "user", "content": "How many pets do I have?"})

payload = {
    "model": "kopro-1.5",
    "messages": history,
    "temperature": 0.7
}

response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data["choices"][0]["message"]["content"])
# => "You have 2 dogs in your house!"
const history = [
  { role: "user", content: "I have 2 dogs in my house." },
  { role: "assistant", content: "That's lovely! What breeds are they?" },
  { role: "user", content: "How many pets do I have?" }
];

const response = await fetch("https://api.kopro.mom/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer kp_live_your_api_key",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "kopro-1.5",
    messages: history,
    temperature: 0.7
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);
curl -X POST https://api.kopro.mom/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer kp_live_your_api_key" \
  -d '{
    "model": "kopro-1.5",
    "messages": [
      {"role": "user", "content": "Explain quantum entanglement in 1 sentence"}
    ],
    "temperature": 0.7
  }'

Streaming Responses (SSE)

Pass "stream": true in your request body to receive real-time Server-Sent Events (SSE) as tokens are synthesized:

import requests
import json

url = "https://api.kopro.mom/v1/chat/completions"
headers = {
    "Authorization": "Bearer kp_live_your_api_key",
    "Content-Type": "application/json"
}
payload = {
    "model": "kopro-1.5",
    "messages": [{"role": "user", "content": "Write a short poem about code."}],
    "stream": True
}

with requests.post(url, headers=headers, json=payload, stream=True) as resp:
    for line in resp.iter_lines():
        if line and line.startswith(b"data: "):
            raw = line[6:].decode("utf-8").strip()
            if raw == "[DONE]":
                break
            chunk = json.loads(raw)
            token = chunk["choices"][0]["delta"].get("content", "")
            print(token, end="", flush=True)
const resp = await fetch("https://api.kopro.mom/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer kp_live_your_api_key",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "kopro-1.5",
    messages: [{ role: "user", content: "Write a short poem about code." }],
    stream: true
  })
});

const reader = resp.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const chunk = decoder.decode(value);
  for (const line of chunk.split("\n")) {
    if (line.startsWith("data: ") && !line.includes("[DONE]")) {
      const parsed = JSON.parse(line.slice(6));
      process.stdout.write(parsed.choices[0].delta.content || "");
    }
  }
}

Pass "web_search": true in your payload to equip the model with live web verification. Kopro queries real-time web databases, extracts factual sources, and embeds markdown citations automatically:

Python Grounding Request
import requests

resp = requests.post(
    "https://api.kopro.mom/v1/chat/completions",
    headers={"Authorization": "Bearer kp_live_your_api_key"},
    json={
        "model": "kopro-1.5",
        "messages": [{"role": "user", "content": "What are the latest developments in fusion energy this week?"}],
        "web_search": True
    }
)
print(resp.json()["choices"][0]["message"]["content"])

Image Generation

When prompts contain visual intent like "draw a cyberpunk neon city" or "generate an astronaut on Mars", Kopro produces direct high-resolution 1024x1024 artwork rendered seamlessly via Pollinations:

Direct CDN endpoint format:
https://image.pollinations.ai/prompt/{prompt}?width=1024&height=1024&nologo=true

Token Usage & Telemetry

Every API call is automatically recorded with token volume, model duration, and latency. You can query your key's usage programmatically at any time:

GET /api/keys/usage
curl https://api.kopro.mom/api/keys/usage \
  -H "Authorization: Bearer kp_live_your_api_key"