Create a response

Endpoint
POST/v1/responses

OpenAI Responses API compatible endpoint. GPT models only: calling Claude or Gemini here returns 400. Use Create a message for Claude and the Gemini native format for Gemini.

Request

Header Value Notes
Authorization Bearer sk-moyiapi-xxxxxx Authentication. x-api-key also works
content-type application/json

Minimal request body:

json
{
  "model": "gpt-5.6-sol",
  "input": "Introduce Moyi API in one sentence"
}

Parameters

Field Type Required Notes
model string Yes A GPT model ID
input string or array Yes The input
stream boolean No Set to true for SSE streaming
reasoning.effort string No Reasoning effort, such as low
tools array No Tools; {"type": "web_search"} and {"type": "function", ...} are supported
service_tier string No Set to fast to enable fast mode

Other fields pass through in the OpenAI Responses API format.

Response

object is response; results are in the output array, distinguished by item type:

Output item type Notes
message The model's reply; text is in content[].text (content[].type is output_text)
function_call The model requests a function call; name and arguments are the call
web_search_call The model ran a web search
reasoning A reasoning summary item

status is completed when generation finished; usage has input_tokens, output_tokens, total_tokens, and their _details.

With stream set to true, the standard Responses API event stream is returned: response.createdresponse.in_progressresponse.output_item.addedresponse.content_part.added → one or more response.output_text.deltaresponse.output_text.done → … → response.completed, which ends the stream. The stream opens with codex.rate_limits and codex.response.metadata and emits responsesapi.websocket_timing just before the end; these three extra events can be ignored.

Examples

Basic request

bash
curl https://api.moyiapi.com/v1/responses \
  -H "Authorization: Bearer sk-moyiapi-xxxxxx" \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "input": "Introduce Moyi API in one sentence"
  }'

Python SDK

python
from openai import OpenAI

client = OpenAI(
    api_key="sk-moyiapi-xxxxxx",
    base_url="https://api.moyiapi.com/v1",
)

resp = client.responses.create(
    model="gpt-5.6-sol",
    input="Introduce Moyi API in one sentence",
)
print(resp.output_text)

Streaming request

Add "stream": true to the body; everything else stays the same.

Errors

HTTP status error.type When it happens
401 missing_auth_credential / invalid_api_key / invalid_bearer_token Authentication failed; see Authentication
400 invalid_request_error Model and protocol mismatch, such as calling Claude on this endpoint
400 model_not_available The model ID does not exist or is temporarily unavailable
Ready? Three steps to startLog in to the console · top up · create an API key
DiscordGet community help instantly
Create a response · Docs