Mafdet AI Help Center中文

Your first API call

Once you have an API key, send your first request with curl.

Request

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": "Describe Mafdet AI in one sentence" }]
  }'

Replace sk-mafdet-xxxxxxxxxxxxxxxx with your own key.

Successful response

{
  "id": "chatcmpl-...",
  "model": "gemini-3-flash-lite",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "Mafdet AI is a unified AI model gateway." },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 12, "completion_tokens": 18, "total_tokens": 30 }
}

The reply text is in choices[0].message.content.

Common failures

SymptomMeaningFix
401 unauthorizedWrong key or bad formatCheck Authorization: Bearer sk-mafdet-...
insufficient_creditOut of balanceSee Balance & usage
MODEL_NOT_ALLOWEDAccount/key lacks access to the modelSee Permissions & model scope

Full list at Errors & troubleshooting.

Next steps