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
- A Melious account (sign up free)
- An API key from melious.ai/account/api/keys
Quick Start
Create Your API Key
- Go to melious.ai/account/api/keys
- Click Create API Key
- Give it a name (e.g., "Development")
- 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 openaiMake 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:
| Brand | Popular Models |
|---|---|
| OpenAI (OSS) | gpt-oss-120b, gpt-oss-20b |
| Qwen | qwen3-235b-a22b-instruct, qwen3-coder-480b-a35b-instruct |
| Moonshot | kimi-k2-instruct, kimi-k2-thinking |
| DeepSeek | deepseek-r1-0528 |
| Mistral | mistral-small-3.2-24b-instruct, devstral-small-2505 |
gemma-3-27b | |
| Meta | llama-3.3-70b-instruct, llama-3.1-8b-instruct |
| NousResearch | hermes-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
Chat with Vision
Send images along with text for visual understanding.
Function Calling
Let models call your functions and tools.
Streaming
Get real-time responses as they're generated.
Embeddings
Generate vector embeddings for search and RAG.
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-hereimport 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
Chat Completions
Full guide with all parameters.
Available Models
Explore 40+ available models.
AI Tools
Web search, URL scraping, and more.
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-4o→gpt-oss-120borqwen3-235b-a22b-instructgpt-4o-mini→llama-3.1-8b-instructorqwen3-32btext-embedding-3-small→bge-m3orqwen3-embedding-8b
Get Help
- API Keys: melious.ai/account/api/keys
- Settings: melious.ai/account/settings/data
- Email: support@melious.ai