Chat with Responses
Chats and Reponses are the two most used entry points in the text series. POST /v1/chat/completions is usually used when an OpenAI-compatible client is already in the text series; POST /v1/responses is used when a Reponses format, multi-modular input or tool call style is needed. Claude compatible client POST /v1/messages.
Chat Completions
http
POST /v1/chat/completionsbash
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": "system",
"content": "你是一个简洁的开发者助手。"
},
{
"role": "user",
"content": "写一句 API 接入成功后的欢迎语。"
}
]
}'Responses
http
POST /v1/responses
POST /v1/responses/compactbash
curl https://moonnexai.com/v1/responses \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"input": "请把这句话改写得更适合开发者文档:接入以后就可以用了。"
}'Long conversations need to be reduced by using POST /v1/responses/compact and choosing a model that supports the context compression.
Messages
http
POST /v1/messagesbash
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
| field | Application API | Annotations |
|---|---|---|
model | All | Model name. |
messages | Chat Completions, Messages | Multi-cycle conversation messages. |
input | Responses | text or structured input. |
max_tokens | Messages, etc. | Limit the length of generation. |
stream | API supporting streaming | Use SSE when setting true to return. |
Select Recommendations
| Requirements | Recommendations |
|---|---|
| Compatible common chat client | Use /v1/chat/completions. |
| Use Responses format | Use /v1/responses. |
| Use Claude to compatibility request body | Use /v1/messages. |
| Streaming output needed | Confirm SSE support in the client and set stream: true. |