MorphogenDocs
API

Responses

POST /v1/responses: a text request in the OpenAI Responses format.

POST/v1/responses

Sends a request to a text model in the OpenAI Responses format. client.responses.create(...) from the OpenAI SDK and Codex works. The service does not store history: the store and previous_response_id fields are not supported, and every request carries the whole context.

Headers

HeaderValue
AuthorizationBearer <key>. Required. x-api-key: <key> is accepted instead
Content-Typeapplication/json
X-PII-Maskingon or off. PII masking
X-Morphogen-Spacespc_…: the spending space. Optional

Request body

modelstringrequired

A model name from GET /v1/models.

inputstring | arrayrequired

A string or a list of input items: messages, input_image, function_call_output.

instructionsstring

The system instruction.

max_output_tokensinteger

The maximum response length. Always pass it: without it, an amount based on the model's maximum response length is reserved.

streamboolean

true turns on a streaming response with Responses events.

toolsarray

Function descriptions for tool calls.

storeboolean

Only false or no field. true gives 400 stateful_not_supported.

previous_response_idstring

Not supported. Any value gives 400 stateful_not_supported.

Request example

curl https://api.morphogen.ru/v1/responses \
  -H "Authorization: Bearer $MORPHOGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "max_output_tokens": 300,
    "input": "Назови столицу Франции одним словом"
  }'

Response example

{
  "id": "resp_01HzQ4",
  "object": "response",
  "status": "completed",
  "model": "gpt-6-luna",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "Париж" }]
    }
  ],
  "usage": { "input_tokens": 14, "output_tokens": 4, "total_tokens": 18 }
}

If the model spent the whole max_output_tokens on reasoning, the response status is incomplete. In a stream, the response.incomplete event arrives in this case. Leave the model headroom in length.

Errors

400stateful_not_supportedThe request has store: true or previous_response_id.
400invalid_jsonThe request body could not be parsed.
400model_category_mismatchThe model is not a text model.
401invalid_api_keyThe key is missing, invalid, revoked or expired.
402insufficient_fundsThe balance does not cover the request reserve.
402key_limit_exceededThe daily or monthly key limit is used up.
403model_not_allowedThe model is not in the key's list.
404model_not_foundThere is no such model in the catalog.
413request_too_largeThe request body is larger than 32 MiB.
429rate_limit_exceededThe request or token limit per minute is exceeded. Retry after the time in Retry-After.
503service_unavailableThe service is temporarily unavailable. Retry the request.

Other codes: Errors.

On this page