Responses
Responses is suitable for text generation, multi-modular input and tool call style access using the Responses format. OpenAI-compatible SDK is available to continue using Base URL and Bearer authentication.
API Path
| Methodology | Path | Returns by |
|---|---|---|
POST | /v1/responses | synchronous JSON or SSE streaming returned. |
POST | /v1/responses/compact | Compress the context of the long conversation and return the results of the compressions. |
Example request
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": "请把这句话改写得更适合开发者文档:接入以后就可以用了。"
}'Common field
| field | Annotations |
|---|---|
model | Model name. |
input | text or structured input. |
instructions | Additional constraints on output objectives and style. |
max_output_tokens | Limits the output length. |
stream | Use streaming to return when setting true. |
Context compression
Long conversations require a condensed context, which allows POST /v1/responses/compact to be called. This API is suitable for keeping key context and reducing subsequent request lengths on the client or service side.
bash
curl https://moonnexai.com/v1/responses/compact \
-H "Authorization: Bearer <MOONNEXAI_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra-openai-compact",
"input": "请压缩目前对话,保留用户目标、关键约束和下一步动作。"
}'| field | Annotations |
|---|---|
model | A model name that supports the context compression. |
input | You need to compress the text or message array. |
instructions | Optional. Specifies the compression style, retention focus or output format. |
previous_response_id | Optional. Continue with the RSPons processes. |
Apply scene
| scene | Recommendations |
|---|---|
| New AccessResons Format | Use /v1/responses. |
| Long Console | Use /v1/responses/compact. |
| Traditional Chat Client | Use Chat Completions. |
| Claude Compatible Client | Use Messages. |
response Processing
| scene | Treatment |
|---|---|
| Normal Return | Reads the final output text from an response object. |
| streaming returns | Merges the incremental content by SSE events. |
| Multi-modular Input | Saves input media assets URL, request body and final output for reset. |