Skip to content

OpenAI-compatible ​

MoonNexAI offers many compatible formats to facilitate access to MoonNexAI. Common scenarios include chats, Responsions, Messages, Voice, transcription, Translation and embeddings.

Base URL ​

OpenAI SDK compatible client is usually used:

text
https://moonnexai.com/v1

Authentication:

http
Authorization: Bearer <MOONNEXAI_API_KEY>

Chat Completions ​

bash
curl https://moonnexai.com/v1/chat/completions \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-terra",
    "messages": [
      {
        "role": "user",
        "content": "写一句简短的产品欢迎语。"
      }
    ]
  }'

Responses ​

bash
curl https://moonnexai.com/v1/responses \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "请把这句话改写得更适合开发者文档。"
  }'

Messages ​

bash
curl https://moonnexai.com/v1/messages \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonnexai-claude",
    "max_tokens": 512,
    "messages": [
      {
        "role": "user",
        "content": "总结这个 API 的用途。"
      }
    ]
  }'

Embeddings ​

bash
curl https://moonnexai.com/v1/embeddings \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonnexai-embedding",
    "input": "MoonNexAI developer documentation"
  }'

Text transcribing ​

bash
curl https://moonnexai.com/v1/audio/speech \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "input": "Welcome to MoonNexAI.",
    "voice": "alloy",
    "response_format": "mp3"
  }'

transcription and translation ​

bash
curl https://moonnexai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -F "file=@./speech.mp3" \
  -F "model=whisper-1"
bash
curl https://moonnexai.com/v1/audio/translations \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
  -F "file=@./speech.mp3" \
  -F "model=whisper-1"

Model queries ​

bash
curl https://moonnexai.com/v1/models \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>"
bash
curl https://moonnexai.com/v1/models/gpt-5.6-terra \
  -H "Authorization: Bearer <MOONNEXAI_API_KEY>"

See the API Reference for additional fields and response structures.