Morse Messages API
The Messages API from Morse — 1 operation(s) for messages.
The Messages API from Morse — 1 operation(s) for messages.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/trymorse-ai:trymorse-ai-messages-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Morse Messages API
version: '1'
description: 'The Morse API serves chat models through an OpenAI-compatible interface. Each request pays with your Morse account''s credits.
Send an API key from the Morse app with every request, in the Authorization header as Bearer sk_morse_..., to https://inference.trymorse.ai, the inference door, where TLS ends inside the enclave. https://api.trymorse.ai serves the Morse app and refuses any key with 403 use_inference_door, or with 404 wrong_host at a path it does not serve; both name the door''s base URL. A key acts for its account and always pays with credits, never with a plan''s included use. One credit is $0.01. GET /v1/models lists prices in micro-dollars, 10,000 to the credit. Keep keys on your server. Browsers on other sites cannot call the API.
All of an account''s keys and its owner''s use of the Morse app share one budget of requests per minute and one limit on requests in flight. The account''s plan sets both. A request refused for either limit carries Retry-After, the number of seconds to wait. A retried POST is a new request, and the API charges it again.
An error reply is JSON in the Error shape, with a stable code. A path the API does not serve returns 404 as plain text, and a wrong method returns 405 as plain text.'
servers:
- url: https://inference.trymorse.ai
security:
- apiKey: []
tags:
- name: Messages
paths:
/v1/messages:
post:
operationId: createMessage
summary: Create a message (Anthropic Messages)
description: 'Takes an Anthropic Messages request on any Morse chat model and answers in Anthropic''s format, whole or as a stream, so Anthropic''s SDKs and Claude Code 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, and it keeps no state between requests. The key goes in Authorization: Bearer or in x-api-key. The query string, such as ?beta=true, is ignored, and so are the anthropic-version and anthropic-beta headers.
A stream is Anthropic''s named events: message_start, then for each text, thinking, or tool_use block a content_block_start, its deltas, and a content_block_stop, then message_delta with the stop_reason and the usage, and message_stop. It sends no [DONE]. A comment line (: keepalive), and a ping event every 15 seconds while the model reasons unseen, keep an idle stream open, and 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 an error event and no message_stop. Usage splits the prompt as Anthropic does, into input_tokens, cache_read_input_tokens, and cache_creation_input_tokens.
Morse refuses, with a 400 in Anthropic''s envelope that names it: server tools, document blocks, images linked by URL, output_config.format, top_k, and context_management, container, and mcp_servers ("Extra inputs are not permitted"). End-to-end encrypted chats are served only on POST /v1/chat/completions.'
security:
- apiKey: []
- anthropicAPIKey: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/MessagesRequest'
example:
model: glm-5.3
max_tokens: 1024
system: Answer in one sentence.
messages:
- role: user
content: What is a TEE?
stream: true
responses:
'200':
description: 'The reply: a Message, or a stream of Anthropic events when stream is true.'
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
X-Funding:
$ref: '#/components/headers/X-Funding'
X-Request-Id:
$ref: '#/components/headers/X-Request-Id'
X-Tier:
$ref: '#/components/headers/X-Tier'
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
example:
id: msg_YYOKD77FV2J75JOVRH6T77B4GZ
type: message
role: assistant
model: glm-5.3
content:
- type: text
text: A TEE is hardware that runs code where its host cannot read it.
stop_reason: end_turn
stop_sequence: null
usage:
input_tokens: 4
cache_creation_input_tokens: 0
cache_read_input_tokens: 20
output_tokens: 19
text/event-stream:
schema:
type: string
x-event-schema:
oneOf:
- $ref: '#/components/schemas/MessageStreamEvent'
- $ref: '#/components/schemas/AnthropicError'
example: 'event: message_start
data: {"type":"message_start","message":{"content":[],"id":"msg_YYOKD77FV2J75JOVRH6T77B4GZ","model":"glm-5.3","role":"assistant","stop_reason":null,"stop_sequence":null,"type":"message","usage":{"input_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0}},"obfuscation":"Xg7U0KyODYismlz2"}
event: content_block_start
data: {"content_block":{"text":"","type":"text"},"index":0,"type":"content_block_start","obfuscation":"NYdsGQw6HoQVX7pC"}
event: content_block_delta
data: {"delta":{"text":"A TEE","type":"text_delta"},"index":0,"type":"content_block_delta","obfuscation":"ODcrHz43Uy9SG40z"}
event: content_block_stop
data: {"index":0,"type":"content_block_stop","obfuscation":"Ne5p8eJhXg7U0Ky"}
event: message_delta
data: {"delta":{"stop_reason":"end_turn","stop_sequence":null},"type":"message_delta","usage":{"input_tokens":4,"cache_creation_input_tokens":0,"cache_read_input_tokens":20,"output_tokens":19},"obfuscation":"ODYismlz2NYdsGQw"}
event: message_stop
data: {"type":"message_stop","obfuscation":"6HoQVX7pCODcrHz4"}
'
'400':
description: The request is malformed, or asks for something Morse does not serve. The message names the field or block.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: invalid_request_error
message: 'tools.0: Input tag ''web_search_20250305'' found using ''type'' does not match any of the expected tags: ''custom''. Morse serves custom tools only, not Anthropic''s server tools.'
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'401':
description: The key is missing or wrong.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: authentication_error
message: The API key is invalid.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'402':
description: The account's credits, or what the key's spend limit has left, do not cover the request.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: billing_error
message: The account balance does not cover the most this request could cost. Add credits from $5 at https://console.trymorse.ai/credits?sheet=add-credits, or set max_tokens or max_completion_tokens to lower the amount held.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
Retry-After:
$ref: '#/components/headers/Retry-After'
'403':
description: The key may not use this model or route.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: permission_error
message: This proxy takes an API key only at https://inference.trymorse.ai/v1, where TLS ends inside the enclave. Set the client's base URL to it.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'404':
description: The model does not exist, or the key may not see it.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: not_found_error
message: The requested model does not exist.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'413':
description: The request body is too large.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: request_too_large
message: Request body is too large.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'429':
description: A rate or concurrency limit was reached. Retry after the time in the Retry-After header.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: rate_limit_error
message: Rate limit reached for this account. Retry after the time in the Retry-After header.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
Retry-After:
$ref: '#/components/headers/Retry-After'
'502':
description: The model provider failed or refused the request.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: api_error
message: The upstream model server failed.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
'503':
description: The model provider is busy, or the service is restarting. Retry.
content:
application/json:
schema:
$ref: '#/components/schemas/AnthropicError'
example:
type: error
error:
type: overloaded_error
message: The model provider is busy. Try again shortly.
headers:
X-Morse-Version:
$ref: '#/components/headers/X-Morse-Version'
Retry-After:
$ref: '#/components/headers/Retry-After'
tags:
- Messages
components:
schemas:
MessagesRequest:
type: object
description: An Anthropic Messages request. Morse reads it as a chat completion and serves it on any chat model, with the same billing, privacy floors, and failover. Fields Morse does not use, such as metadata and service_tier, are ignored.
required:
- model
- max_tokens
- messages
properties:
model:
type: string
description: A model id from GET /v1/models. Anthropic's own id for a Claude model, such as claude-opus-5-5 or a dated id like claude-opus-5-5-20261001, also names the Morse model anthropic/claude-opus-5.5.
max_tokens:
type: integer
minimum: 1
description: The output limit. Morse clamps it to the model's limit, as it clamps max_completion_tokens.
messages:
type: array
description: 'The conversation. A user turn takes text, image (base64 source only), and tool_result blocks; a tool_result with is_error true reaches the model with its text prefixed "Error: ". An assistant turn takes text and tool_use blocks. thinking and redacted_thinking blocks are dropped. A message with role system is sent as a system message in its place. document blocks, images linked by URL, images inside a tool_result, and every other block type are refused with a 400 that names the type.'
items:
type: object
required:
- role
- content
properties:
role:
type: string
enum:
- user
- assistant
- system
content:
oneOf:
- type: string
- type: array
items:
type: object
system:
description: 'The system prompt, a string or text blocks. Blocks are joined with a blank line. cache_control is ignored: Morse places its own cache breakpoints.'
oneOf:
- type: string
- type: array
items:
type: object
stream:
type: boolean
description: Stream the reply as Anthropic's named server-sent events.
tools:
type: array
description: Custom tools (name, description, input_schema). Anthropic's server tools, such as web_search or code_execution, are refused with a 400 that names the type.
items:
type: object
tool_choice:
type: object
description: auto, any, tool (with name), or none. disable_parallel_tool_use asks for at most one tool call.
thinking:
type: object
description: enabled with budget_tokens sets a reasoning effort from the budget. enabled or adaptive also streams the model's reasoning as thinking blocks where the model shows it. Thinking blocks carry no signature.
output_config:
type: object
description: 'effort sets the reasoning effort (low, medium, high, xhigh, or max). format is refused: Morse serves no structured outputs.'
stop_sequences:
type: array
items:
type: string
description: Sent as stop. An API key needs forward_settings, as for a chat completion's stop.
temperature:
type: number
description: 1, Anthropic's default, is ignored. Any other value needs forward_settings, as for a chat completion.
top_p:
type: number
description: 1 is ignored. Any other value needs forward_settings, as for a chat completion.
provider:
type: object
description: Morse's per-request privacy floor, as on POST /v1/chat/completions.
privacy_veil:
description: Morse's Privacy Veil ask, as on POST /v1/chat/completions.
MessageStreamEvent:
type: object
description: 'One Anthropic stream event: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop, ping, or error. Each data object also carries an obfuscation string of random length.'
required:
- type
properties:
type:
type: string
MessageUsage:
type: object
description: 'Tokens as Anthropic counts them: input_tokens is the prompt read neither from nor into the cache.'
required:
- input_tokens
- output_tokens
- cache_creation_input_tokens
- cache_read_input_tokens
properties:
input_tokens:
type: integer
output_tokens:
type: integer
cache_creation_input_tokens:
type: integer
cache_read_input_tokens:
type: integer
Message:
type: object
description: 'An Anthropic Message: the whole reply.'
required:
- id
- type
- role
- model
- content
- stop_reason
- usage
properties:
id:
type: string
type:
type: string
enum:
- message
role:
type: string
enum:
- assistant
model:
type: string
description: The model as the request named it.
content:
type: array
items:
type: object
required:
- type
properties:
type:
type: string
enum:
- text
- thinking
- tool_use
stop_reason:
type: string
enum:
- end_turn
- tool_use
- max_tokens
- refusal
stop_sequence:
type:
- string
- 'null'
usage:
$ref: '#/components/schemas/MessageUsage'
AnthropicError:
type: object
description: 'Anthropic''s error envelope. error.type follows the status: invalid_request_error (400), authentication_error (401), billing_error (402), permission_error (403), not_found_error (404), request_too_large (413), rate_limit_error (429), api_error (500 and 502), overloaded_error (503).'
required:
- type
- error
properties:
type:
type: string
enum:
- error
error:
type: object
required:
- type
- message
properties:
type:
type: string
message:
type: string
headers:
X-Tier:
description: 'The privacy tier of the endpoint that served the reply. 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, and 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.'
schema:
enum:
- anon
- private
- tee
- e2ee
Retry-After:
description: Whole seconds to wait before retrying, at least 1.
schema:
type: integer
minimum: 1
X-Request-Id:
description: An 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.
schema:
type: string
X-Morse-Version:
description: The running build. Every reply carries it.
schema:
type: string
X-Funding:
description: What 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.
schema:
type: string
enum:
- credits
- included
securitySchemes:
anthropicAPIKey:
type: apiKey
in: header
name: x-api-key
description: The same sk_morse_ API key, in the header the Anthropic SDKs send it in. Morse reads it when the request has no Authorization header.
apiKey:
type: http
scheme: bearer
bearerFormat: sk_morse_...
description: An API key from the Morse app. It starts with sk_morse_.