Melious

Getting Started

Make your first Melious API call in under 5 minutes

Getting Started

Get up and running with the Melious API in under 5 minutes. This guide shows you how to make your first API call using the OpenAI SDK or direct HTTP requests.


Prerequisites


Quick Start

Create Your API Key

  1. Go to melious.ai/account/api/keys
  2. Click Create API Key
  3. Give it a name (e.g., "Development")
  4. Copy the key immediately - it's only shown once!

Store your API key securely. Never commit it to version control or expose it in client-side code.

Install the OpenAI SDK (Optional)

Melious is fully compatible with the official OpenAI SDK:

pip install openai

Make Your First Request

from openai import OpenAI

client = OpenAI(
    api_key="sk-mel-your-api-key-here",
    base_url="https://api.melious.ai/v1"
)

response = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=[{"role": "user", "content": "Say hello!"}]
)

print(response.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-mel-your-api-key-here',
  baseURL: 'https://api.melious.ai/v1'
});

const response = await client.chat.completions.create({
  model: 'gpt-oss-120b',
  messages: [{ role: 'user', content: 'Say hello!' }]
});

console.log(response.choices[0].message.content);
curl https://api.melious.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-mel-your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-oss-120b",
    "messages": [{"role": "user", "content": "Say hello!"}]
  }'

Expected Response:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1699999999,
  "model": "gpt-oss-120b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 8,
    "total_tokens": 18
  }
}

Available Models

Melious provides access to 40+ open-source models from leading AI research labs:

BrandPopular Models
OpenAI (OSS)gpt-oss-120b, gpt-oss-20b
Qwenqwen3-235b-a22b-instruct, qwen3-coder-480b-a35b-instruct
Moonshotkimi-k2-instruct, kimi-k2-thinking
DeepSeekdeepseek-r1-0528
Mistralmistral-small-3.2-24b-instruct, devstral-small-2505
Googlegemma-3-27b
Metallama-3.3-70b-instruct, llama-3.1-8b-instruct
NousResearchhermes-4-405b, hermes-4-70b
# List all models
curl https://api.melious.ai/v1/models \
  -H "Authorization: Bearer sk-mel-your-api-key-here"

Privacy-first: All models are open-source and self-hosted on European infrastructure. Your data is never sent to OpenAI, Anthropic, or Google.


Try Different Features


Streaming Responses

Get responses in real-time:

stream = client.chat.completions.create(
    model="gpt-oss-120b",
    messages=[{"role": "user", "content": "Write a haiku"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Vision: Analyze Images

Send images for visual understanding (with vision-capable models):

response = client.chat.completions.create(
    model="mistral-small-3.2-24b-instruct",  # Vision-capable model
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What's in this image?"},
                {"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}}
            ]
        }
    ]
)

Vision-capable models: mistral-small-3.2-24b-instruct, mistral-small-3.2-24b-instruct


Environment Variables

For production applications:

# .env file
MELIOUS_API_KEY=sk-mel-your-api-key-here
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("MELIOUS_API_KEY"),
    base_url="https://api.melious.ai/v1"
)

Error Handling

from openai import OpenAI, APIError, RateLimitError, AuthenticationError

client = OpenAI(
    api_key="sk-mel-your-api-key-here",
    base_url="https://api.melious.ai/v1"
)

try:
    response = client.chat.completions.create(
        model="gpt-oss-120b",
        messages=[{"role": "user", "content": "Hello!"}]
    )
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limited - wait and retry")
except APIError as e:
    print(f"API error: {e}")

Next Steps


Migrate from OpenAI

Already using OpenAI? Migration is simple:

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

# After (Melious) - just add base_url!
from openai import OpenAI
client = OpenAI(
    api_key="sk-mel-...",
    base_url="https://api.melious.ai/v1"
)

# Your existing code works unchanged!
# Note: Use open-source model names (e.g., gpt-oss-120b instead of gpt-4o)

When migrating, replace model names with Melious equivalents:

  • gpt-4ogpt-oss-120b or qwen3-235b-a22b-instruct
  • gpt-4o-minillama-3.1-8b-instruct or qwen3-32b
  • text-embedding-3-smallbge-m3 or qwen3-embedding-8b

Get Help

On this page