DEV Community

Robin
Robin

Posted on

Your First Komilion API Call in 60 Seconds

Your First Komilion API Call in 60 Seconds

By Hossein Shahrokni | March 2026

If you just signed up for Komilion and are staring at a blank dashboard: here's exactly what to do. This takes 60 seconds.


What you need

  • Your Komilion API key (starts with ck_ — visible in your dashboard)
  • Python 3.7+ or Node.js 16+, OR curl

That's it. No new SDK. Komilion is OpenAI-compatible — if you've used the OpenAI API before, the interface is identical.


Option 1: Python (60 seconds)

Install the OpenAI SDK if you haven't already:

pip install openai
Enter fullscreen mode Exit fullscreen mode

Then run this:

from openai import OpenAI

client = OpenAI(
    base_url="https://www.komilion.com/api/v1",
    api_key="ck_your_key"  # paste your actual key here
)

response = client.chat.completions.create(
    model="neo-mode/balanced",
    messages=[{"role": "user", "content": "What is the fastest way to find a duplicate in a Python list?"}]
)

print(response.choices[0].message.content)

# See what model handled it and what it cost:
print("Model:", response.model_extra["komilion"]["brainModel"])
print("Tier:", response.model_extra["komilion"]["tier"])
print("Cost:", response.model_extra["komilion"]["cost"])
Enter fullscreen mode Exit fullscreen mode

When you see output — you're in. The brainModel field shows which model handled your request. The tier will say "balanced". The cost is what that call cost in USD.


Option 2: curl (30 seconds)

curl https://www.komilion.com/api/v1/chat/completions \
  -H "Authorization: Bearer ck_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "neo-mode/balanced",
    "messages": [{"role": "user", "content": "What is the fastest way to find a duplicate in a Python list?"}]
  }'
Enter fullscreen mode Exit fullscreen mode

You'll get a standard OpenAI-format JSON response plus a komilion object in the response body with routing metadata.


Option 3: Existing OpenAI code (20 seconds)

If you already have code using the OpenAI SDK, change two lines:

# Before
client = OpenAI(api_key="sk-...")

# After
client = OpenAI(
    base_url="https://www.komilion.com/api/v1",
    api_key="ck_your_key"
)
Enter fullscreen mode Exit fullscreen mode

Change the model string to neo-mode/balanced. Every other parameter — messages, temperature, stream, max_tokens — stays the same.


What the three model strings do

Once you have the first call working, here's how to use all three tiers:

# Commit messages, summaries, format conversion — ~$0.006/call
response = client.chat.completions.create(
    model="neo-mode/frugal",
    messages=[{"role": "user", "content": "Write a git commit message for this diff: ..."}]
)

# Bug fixes, code review, new functions — ~$0.08/call (default)
response = client.chat.completions.create(
    model="neo-mode/balanced",
    messages=[{"role": "user", "content": "Review this function for edge cases: ..."}]
)

# System design, architecture, security review — council mode, ~90s response
response = client.chat.completions.create(
    model="neo-mode/premium",
    messages=[{"role": "user", "content": "Design the database schema for a multi-tenant SaaS: ..."}]
)
Enter fullscreen mode Exit fullscreen mode

The routing metadata in every response tells you what tier was used and what it cost.


If something goes wrong

401 Unauthorized — API key is wrong or missing. Make sure you're using your ck_ key, not an OpenAI key.

400 Bad Request on the model string — The model string must be exactly neo-mode/frugal, neo-mode/balanced, or neo-mode/premium. Do not use anthropic/claude-opus-4-6 or any other model string — those will return 400.

402 Insufficient Balance — Your wallet balance is $0. Top up at komilion.com/dashboard.

Empty komilion metadata — Upgrade to openai>=1.0.0. The model_extra field requires the newer SDK.

Slow response on Premium — Expected. The council runs multiple specialists, which can take up to 90 seconds. Use Balanced for interactive requests.


What's next

Once your first call works:

  • Use neo-mode/balanced as the default everywhere in your codebase
  • Override to neo-mode/frugal for formatting, summarization, and commit messages
  • Override to neo-mode/premium only when the output is going to production without review

The Phase 4 benchmark (30 calls, 10 developer tasks, all outputs published) is at komilion.com/compare-v2 — worth reading before you commit to a tier strategy.


Questions: support@komilion.com

Top comments (0)