API Documentation

OpenAI-compatible API. Get started in minutes with any language or framework.
Quick Start

Replace your OpenAI base URL with ModelHub to access 100+ models through one API.

# Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
  base_url="https://api.modelhub.ai/v1",
  api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
  model="gpt-4o",
  messages=[{"role": "user", "content": "Hello!"}]
)
# curl
curl https://api.modelhub.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Endpoints
POST /v1/chat/completions
Chat completions. Supports streaming, function calling, JSON mode.
POST /v1/embeddings
Create embeddings for text. Compatible with OpenAI embeddings API.
GET /v1/models
List all available models. Same format as OpenAI.
POST /v1/images/generations
Image generation (selected models).
SDK & Libraries
Python
pip install openai
Node.js
npm install openai
Go
go get github.com/openai/openai-go
Curl
No SDK needed
Get API Key

Sign up to get your API key and start making requests.