The Mibyan API is fully OpenAI-compatible, allowing you to use standard OpenAI clients, the Vercel AI SDK, or simple HTTP requests to interact with Mibyan’s powerful models.
Base URL
All API requests should be made to the following base URL:
https://mibyanai.com/api/public/v1
Authentication
The Mibyan API uses API keys for authentication. You can generate and manage your API keys in the API Keys section of the Mibyan Developer Dashboard.
To authenticate your requests, pass your API key (which begins with mb-) in the Authorization header as a Bearer token:
Authorization: Bearer mb-...
Alternatively, you can pass the API key using the custom header:
Keep your API keys secure. Do not share them publicly or commit them to client-side code or public repositories.
Supported Models
Mibyan provides state-of-the-art models for chat completions and text embeddings.
Chat Model
mibyan-4.1: A highly sophisticated, Arabic-first model designed for professional business writing, complex reasoning, and structured outputs. Learn more in the Mibyan 4.1 Model Guide.
Embedding Models
mibyan-embed-1: High-dimensional text embedding model optimized for semantic search and retrieval-augmented generation (RAG). (3072 dimensions)
mibyan-embed-small: A fast, lightweight embedding model suitable for lower-latency semantic tasks. (1536 dimensions)
Client Integration
Because the Mibyan API is OpenAI-compatible, integrating it into your existing projects is straightforward.
Vercel AI SDK
To use Mibyan with the Vercel AI SDK, configure the OpenAI-compatible provider:
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
// Initialize the Mibyan client
export const mibyan = createOpenAICompatible({
name: "mibyan",
baseURL: "https://mibyanai.com/api/public/v1",
headers: {
Authorization: `Bearer ${process.env.MIBYAN_API_KEY}`
},
});
Now you can generate text using standard AI SDK functions:
import { generateText } from "ai";
import { mibyan } from "./mibyan";
const { text } = await generateText({
model: mibyan("mibyan-4.1"),
prompt: "Draft a 90-day launch plan for a parcel delivery service in Muscat.",
});
console.log(text);
Python OpenAI SDK
You can use the official openai Python package by overriding the base_url and api_key:
from openai import OpenAI
client = OpenAI(
base_url="https://mibyanai.com/api/public/v1",
api_key="mb-..."
)
response = client.chat.completions.create(
model="mibyan-4.1",
messages=[
{"role": "user", "content": "Hello! Tell me about Mibyan."}
]
)
print(response.choices[0].message.content)
Node.js OpenAI SDK
Similarly, in Node.js:
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "https://mibyanai.com/api/public/v1",
apiKey: "mb-..."
});
const completion = await openai.chat.completions.create({
model: "mibyan-4.1",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(completion.choices[0].message.content);