Create a response

Send an OpenAI Responses request to any chat model and get its response in OpenAI's Responses format, whole or streamed.

POSThttps://inference.trymorse.ai/v1/responses

Takes an OpenAI Responses request on any Morse chat model and answers in OpenAI's Responses format, whole or as a stream. OpenAI's SDKs, the Agents SDK, and Codex can use Morse by pointing their base URL at it. Morse reads the request as a chat completion, so it is billed, held, routed, and refused exactly as POST /v1/chat/completions is. It keeps no state: every Response says store false. A request that relies on a stored response or conversation is refused.

A stream is OpenAI's named events, each with a sequence_number counting from 0. response.created and response.in_progress come first. Then each output item sends a response.output_item.added, its content's events, and a response.output_item.done. The stream ends with response.completed, or with response.incomplete when the response hit max_output_tokens or a content filter. The ending event carries the whole Response with its usage. The usage includes input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens. Items stay open until the response ends, so their done events come together at the end. It sends no [DONE]. A comment line (: keepalive) keeps an idle stream open. So does a response.in_progress event every 15 seconds while Morse holds back a custom tool's input or reasoning the client did not ask to see. Each event's data carries an obfuscation string of random length that hides the event's size. A stream that fails after it began ends with response.failed, whose Response carries the error.

Function tools are sent to the model as they are. A custom tool is sent as a function that takes its freeform input as one string, input. Its grammar is told in its description, and its call comes back as a custom_tool_call. A namespace tool's functions are sent as <namespace>__<name>, and a call comes back named within its namespace. Reasoning shows as a reasoning item with a summary_text only when the request sets reasoning.summary and the model sends reasoning text. It is the model's reasoning as written. On a model whose vendor keeps the reasoning itself, it is the vendor's own summary of it. A reasoning item in input reaches an open model as the earlier reasoning of the message or tool call after it. It is read from its summary_text and reasoning_text parts, and its encrypted_content is dropped.

Morse refuses each of these with a 400 unsupported_parameter that names the parameter:

  • previous_response_id, conversation, prompt, and context_management
  • store true, background true, and a truncation other than disabled
  • OpenAI's built-in tools (web_search, file_search, code_interpreter, computer use, mcp, image_generation, and the rest)
  • a tool_choice of allowed_tools or a built-in tool
  • a text.format of a type other than text, json_object, or json_schema
  • item_reference items, which a client sends unless its request sets store false
  • file inputs, and images linked by URL or by file_id

Codex sends a web_search tool unless its config sets web_search = "disabled". API keys are not offered end-to-end encryption for now, so a request for an end-to-end encrypted chat is refused with 403.

curl -X POST https://inference.trymorse.ai/v1/responses \
  -H "Authorization: Bearer $MORSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "instructions": "Answer in one sentence.",
    "input": "What is a TEE?",
    "store": false,
    "stream": true
  }'
Response
{
  "id": "resp_YYOKD77FV2J75JOVRH6T77B4GZ",
  "object": "response",
  "created_at": 1792187800,
  "status": "completed",
  "background": false,
  "error": null,
  "incomplete_details": null,
  "instructions": "Answer in one sentence.",
  "max_output_tokens": null,
  "model": "glm-5.3",
  "output": [
    {
      "id": "msg_Q3J75JOVRH6T77B4GZYYOKD77F",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "A TEE is hardware that runs code where its host cannot read it.",
          "annotations": [],
          "logprobs": []
        }
      ]
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "store": false,
  "temperature": null,
  "top_p": null,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "truncation": "disabled",
  "usage": {
    "input_tokens": 24,
    "input_tokens_details": {
      "cached_tokens": 20
    },
    "output_tokens": 19,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 43
  },
  "user": null,
  "metadata": {}
}

Request body

An OpenAI Responses request. Morse reads it as a chat completion and serves it on any chat model, with the same billing, privacy floors, and failover. Parameters Morse does not use are ignored, such as include, prompt_cache_key, service_tier, text.verbosity, user, and client_metadata.

modelstringRequired

A model id from GET /v1/models, named as on POST /v1/chat/completions.

inputstring | array of objectRequired

The whole conversation: a string, which is one user message, or items. A message has role user, assistant, system, or developer, which is sent as system. It takes input_text and input_image (a base64 data URL) parts from the user and text from the others. function_call, function_call_output, custom_tool_call, and custom_tool_call_output items are taken, and reasoning items are dropped. Every other item type is refused.

instructionsstring

Sent as the first system message.

streamboolean
max_output_tokensinteger

The output limit, sent as max_completion_tokens.

toolsarray of object

function, custom, and namespace tools. Built-in tools are refused.

tool_choicestring | object

A mode, or a function or custom tool by name.

parallel_tool_callsboolean
reasoningobject
Show its 2 properties
effortstring

Sent as reasoning_effort.

One of none, minimal, low, medium, high, xhigh, or max.

summarystring

Any value but none asks for the model's reasoning as a reasoning item, where the model streams it.

temperaturenumber

1 is dropped. Any other value needs forward_settings, as on a chat completion.

top_pnumber

1 is dropped. Any other value needs forward_settings, as on a chat completion.

textobject

format asks for JSON: {"type":"json_object"} or {"type":"json_schema","name":...,"schema":{...}}. It is sent as the chat completion's response_format. So it needs forward_settings and a model with an endpoint that honours the type, and is refused with 400 unsupported_parameter on a model with none. {"type":"text"} counts as absent. The Response echoes it.

storeboolean

Only false. Absent is false.

metadataobject

Echoed in the Response.

providerobject

The privacy floor and endpoint choice, as on a chat completion.

Response

The response: a Response, or a stream of response events when stream is true.

idstringRequired
objectstringRequired

One of response.

created_atintegerRequired
statusstringRequired

One of completed, incomplete, failed, or in_progress.

incomplete_detailsobject | null

Why the response is incomplete: max_output_tokens or content_filter.

errorobject | null
modelstringRequired

The model as the request named it.

outputarray of objectRequired
Show its 1 property
typestringRequired

One of message, reasoning, function_call, or custom_tool_call.

storeboolean

One of false.

usageResponseUsage | nullRequired
Show its 5 properties
input_tokensintegerRequired
input_tokens_detailsobjectRequired
output_tokensintegerRequired
output_tokens_detailsobjectRequired
total_tokensintegerRequired

Response headers

HeaderWhat it says
X-Morse-VersionThe running build. Every response the server makes carries it. A refusal the inference door makes itself does not, such as its 404 not_found or its 401 for a request with no key.
X-FundingWhat pays for the request. With a key, the value is always credits. A request that Morse refuses before it bills anything has no X-Funding.
X-Ratelimit-Limit-RequestsThe account's requests per minute, the limit behind 429 rate_limit_exceeded. All of the account's keys and its owner's use of the Morse app share it. A response carries the three X-Ratelimit headers when the account's rate limit judged its request. That is a request a key sends that Morse bills and that this limit judged, and the 429 rate_limit_exceeded this limit returns. A request paced by the included allowance carries none, and neither does a replayed response. A 429 from a route's own allowance carries none either, such as search's 90 calls a minute. Morse has no token rate limit, so it sends no x-ratelimit-*-tokens headers.
X-Ratelimit-Remaining-RequestsHow many more requests the account could send at once, as of this response, before a 429 rate_limit_exceeded. Requests sent since, by any of its keys, lower it. The account regains one request every 60 seconds divided by its limit. It holds at most its limit divided by 10 (rounded down, at least 1) plus one at once. 0 on the 429.
X-Ratelimit-Reset-RequestsThe time until the account may send its whole burst at once again. It is rounded up to a whole second and written as 1s, 45s, or 6m0s. 0s when it already may.
X-Request-IdAn id for this request. Quote it when you contact support about the request. An error that arrives after the request starts carries it too. A request that Morse refuses before it bills anything has no X-Request-Id.
X-Output-LimitedSet when Morse lowered the output limit so that the request fits. balance means the account's credits, and key_limit means what the key's spend limit has left.
X-TierThe privacy tier of the endpoint that served the response. TEE is opt-in. A request on a model id is served at private or anon, at or above its provider.min_privacy and the key's minimum tier. It is served at tee only when either of those is tee, or the model has no private or anon endpoint at or above them. This header says which tier served it. It is at least the request's floor. No header names the provider or the endpoint.
X-Model-SuccessorSet when the request named a retired model id: the id that replaced it, which served the request. A retired id keeps working and is billed at its replacement's price. The docs list every retired id and its replacement.

Errors

Every error has the same shape. Error codes explains it and when to retry.

400The request is malformed, or asks for something Morse does not serve. param names the parameter.19 codes
invalid_request_body

The body is not a JSON object, a parameter has the wrong JSON type, or model is missing.

invalid_parameter

A parameter has a value the endpoint refuses. The message names the parameter.

duplicate_json_key

A JSON object in the body repeats a key.

too_many_messages

messages holds more than 4,096 entries.

request_too_complex

The body holds more than 262,144 JSON values.

invalid_output_limit

max_tokens or max_completion_tokens is not a positive integer.

privacy_floor_unmet

One of these is true:

  • The model's tier is below provider.min_privacy.
  • The model's tier is below the API key's min_privacy, when param is key.min_privacy.
  • The request sets provider.zdr or provider.data_collection deny, and no endpoint at the tiers the request may run at keeps no data.

The message names both tiers. GET /v1/models lists only the models the key may call. Morse refuses before it calls the model or holds any credit.

unsupported_parameter

A parameter asks for something Morse does not serve:

  • a stored response or conversation (previous_response_id, conversation, prompt, context_management, store true, background true, truncation other than disabled)
  • a built-in tool or tool_choice (web_search, file_search, code_interpreter, computer use, mcp, image_generation, and the rest)
  • a text.format of a type other than text, json_object, or json_schema
  • an image linked by URL or by file_id, or a file input
  • an input item Morse cannot carry
  • a parameter that changes the response and that no provider is sent
setting_not_forwarded

An API key whose forward_settings was turned off set temperature, top_p, stop, seed, or n. Morse sends these to no model for that key. A new key has forward_settings on unless it is created with forward_settings false or null. The message names the parameter and the key setting that sends them, "Let my settings reach the model host". It also names the keys page of the developer console where the setting is turned back on. For a request sent to this reference's API address, that page is https://console.trymorse.ai/keys.

provider_choice_unsupported

provider names only, ignore, or enforce_distillable_text. Morse chooses the provider within a privacy tier and refuses a request that would ignore the choice. The message points to the Pricing page, which lists the providers, and to provider.min_privacy, which requires a tier.

max_price_unmet

Every tier of the model costs you more than provider.max_price allows, at your price: list for an API key. The message names the cheapest tier's price.

quantization_unmet

No provider of the model at the tiers the request may run at serves a precision that provider.quantizations admits. param is provider.quantizations, and the message names the precisions those providers do serve. Morse never moves a request to another tier to find one, so a precision that only a tee provider serves needs min_privacy tee. Morse refuses before it calls the model or holds any credit.

invalid_request

A message, part, or tool has a shape the model does not take, or the provider refused the request.

remote_media

A media part links a URL instead of a data: URL.

unsupported_input

An API key's messages carry an image part for a model whose input_modalities in GET /v1/models do not include image. The message names what the model reads. Morse refuses before it calls the model or holds any credit.

message_too_long

In a chat with a character, the last user message holds more than 8,000 bytes of text.

model_unsupported_for_characters

A chat that plays a character, one that sends X-Character or a character's prompt, names a model that GET /v1/models lists with characters false. param is model. Morse refuses before it calls the model or holds any credit.

context_length_exceeded

The conversation is too long for the model.

content_filter

The model provider declined the request.

401The key is missing or wrong.3 codes
invalid_api_key

One of these is true:

  • The Authorization header is missing or not Bearer.
  • The key is unknown or revoked.
  • A token that starts with sk_ is not a whole sk_morse_ key.
  • The bearer is no Morse key or login token at all, such as another service's API key (sk-proj-...).
api_key_expired

The key is past the expiry set on it. Make a new key, or set a later expiry before a key expires.

invalid_token

The bearer is shaped as a Morse login token (a JWT) but its signature fails or it has expired. An API key sends the whole sk_morse_ key.

402The account's credits, or what the key's spend limit has left, do not cover the request.2 codes
insufficient_balance

The balance is below the amount the request must hold. While the balance is negative, the API refuses every metered request. No credit is free when the balance is zero or below, or when requests still running hold all of it. The message then says to add credit. It also says to wait for those requests and set max_tokens or max_completion_tokens lower on each, so each holds less.

key_spend_limit_reached

What the key's spend limit has left in its window is below the amount the request must hold. A limit that resets daily, weekly, or monthly sends Retry-After, the seconds until it resets. A limit that never resets sends none. Raise or remove the limit in the dashboard, and the next request is served.

403The key's account may not make this request.9 codes
account_disabled

Morse has disabled the key's account.

account_deleted

The key's account has been deleted.

account_under_18

The account's owner said they are under 18.

characters_app_only

The first system message opens with the prompt of a Morse character, or the request names one in X-Character-Content or sends X-Writer-Examples. Morse characters are available only in the Morse app, not through an API key.

ip_not_allowed

The key allows requests only from its allowed IPs, and the request came from another address. The message names the address the proxy saw.

sealed_required

The key is sealed_only, and the request came unsealed. Send it inside POST /v1/sealed, as the Morse app does.

e2ee_app_only

The request carries end-to-end encryption headers or names a sealed model. API keys are not offered end-to-end encryption for now. Morse refuses before it calls the model or holds any credit.

model_unavailable_in_region

The model's lab doesn't offer its models where the request comes from. GET /v1/models leaves the model out there.

service_unavailable_in_region

Morse doesn't serve the place the request comes from, because of US sanctions rules and its providers' terms. Every request from there returns this, whatever the key.

404The model does not exist, or it is not a model for this endpoint.1 code
model_not_found

No model of this endpoint's type has that name.

408The request body arrived too slowly.1 code
request_timeout

The request body did not arrive within one minute.

413The request body is too large.1 code
request_too_large

The body is over 32 MiB, or too large for the provider.

429The account is over its rate limit or its concurrency limit. Wait the number of seconds in Retry-After, then retry.2 codes
rate_limit_exceeded

The account used up its requests per minute. All of the account's keys and its owner's use of the Morse app share one budget.

concurrency_limit_exceeded

The account already has its maximum number of requests in flight. Retry-After is 1.

502The model provider failed or refused the request.4 codes
upstream_error

The provider failed or did not answer.

upstream_unavailable

The provider is unavailable right now. Retry later, or choose another model.

upstream_retention

A zero-retention model's provider did not confirm zero data retention.

upstream_refused

The provider refused the request, such as when it does not serve the model to Morse right now. Retry later, or choose another model.

503Morse or the provider is busy or unavailable. Retry the request later.4 codes
service_unavailable

Morse could not start the request. Retry it.

server_busy

Morse is busy. Retry-After is 1.

upstream_busy

The provider is overloaded. Try again shortly.

upstream_unattested

Morse could not verify the attested endpoint. Try again shortly.