Skip to content

Messages ​

The Messages API accepts Claude-compatible request bodies. Its messages array and max_tokens field support Claude-compatible clients with a configurable Base URL.

API Path ​

MethodologyPathReturns by
POST/v1/messagessynchronous JSON or SSE streaming returned.

Example request ​

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 的用途。"
      }
    ]
  }'

Common field ​

fieldAnnotations
modelClaude compatible model name.
messagesDialogue message arrays.
max_tokensOutput token cap.
temperatureOutput random.
streamWhether to use streaming to return.

response Processing ​

sceneTreatment
Normal ReturnReads the message content and saves the model name and request parameters.
streaming returnsCollapse output in an incremental format supported by the client.
Client Error ReportingPriority check for Base URL, model name, authentication and max_tokens.

Access Recommendations ​

  • Select this API first when Claude is already used.
  • If the client only supports OpenAI Chat format, change to Chat Completions.
  • Check Base URL, model name and API Key permissions when request fails.

Relevant Pages ​