Create a response
/v1/responsesOpenAI 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:
{
"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.created → response.in_progress → response.output_item.added → response.content_part.added → one or more response.output_text.delta → response.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
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
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 |