📖 API Documentation

ModelBridge provides a fully OpenAI-compatible API. If you've used the OpenAI SDK before, you already know how to use us — just change the base URL.

Base URL

https://aibridge-api.com/v1

Authentication

All requests require an API key in the Authorization header:

Authorization: Bearer mb-xxxxxxxxxxxxx

🔗 Available Endpoints

MethodEndpointDescription
GET/v1/modelsList available models
POST/v1/chat/completionsChat completion (supports streaming)
POST/v1/embeddingsGenerate text embeddings
GET/healthService health check

🤖 Supported Models

Model IDTypeContext WindowBest For
deepseek-chatChat64KGeneral purpose conversations, coding
deepseek-reasonerReasoning64KComplex reasoning, math, logic
qwen-maxChat32KMultilingual tasks, long context
qwen-plusChat131KCost-effective general usage

💬 Chat Completions

The primary endpoint for generating text responses. Supports both regular and streaming (SSE) modes.

Request

Python
cURL
Node.js
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://aibridge-api.com/v1",
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"},
    ],
)

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

Streaming Response

Set stream: true to receive tokens as they are generated:

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Tell me a story."}],
    stream=True,
)

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

⚠️ Error Codes

Status CodeErrorCauseSolution
401UnauthorizedInvalid or missing API keyCheck your Authorization header
404Not FoundInvalid endpoint or modelVerify the URL and model name
429Rate LimitedToo many requestsReduce frequency; upgrade plan if needed
500Internal ErrorUpstream service issueRetry after a few seconds
502Bad GatewayUpstream unavailableUpstream AI provider is down
504Gateway TimeoutRequest took too longTry with shorter prompts