API Basics
Mafdet AI exposes an OpenAI-compatible Chat Completions API. Any tool or SDK that speaks the OpenAI API format works as-is — just point the Base URL and API key at Mafdet AI.
Base URL
All model calls go through this gateway (the data plane, served by LiteLLM):
https://api.mafdet.ai/v1
Note: the Mafdet AI Business API (platform backend) is not exposed to ordinary model-calling clients. Model calls always go through the
/v1gateway above.
Authentication
Send your API key (prefixed sk-mafdet-) in the request header:
Authorization: Bearer sk-mafdet-xxxxxxxxxxxxxxxx
Content-Type: application/json
API keys are created in the platform and shown only once — store them safely. See Create your first API key.
Your first call
A minimal request with curl:
curl https://api.mafdet.ai/v1/chat/completions \
-H "Authorization: Bearer sk-mafdet-xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3-flash-lite",
"messages": [{ "role": "user", "content": "Hello, introduce yourself" }]
}'
Compatible protocol
Mafdet is OpenAI-compatible: point any OpenAI SDK or client at
https://api.mafdet.ai/v1 with your Mafdet key.
| Endpoint | OpenAI equivalent | Notes |
|---|---|---|
POST /v1/chat/completions | Chat Completions | Streaming supported ("stream": true) |
POST /v1/embeddings | Embeddings | Text, image and video models |
POST /v1/audio/speech | Audio Speech | Preview; Gemini voices, returns audio bytes |
GET /v1/models | Models | Your accessible models |
A model only works on its own endpoint — see Models overview.
- Works with Continue, Cline, and any OpenAI-compatible client
- Supports streaming (
"stream": true), see Streaming