Messages API
Anthropic-compatible /v1/messages endpoint — point an Anthropic SDK at Morph by changing the base URL
Overview
POST /v1/messages mirrors Anthropic’s Messages API. Clients built on an Anthropic SDK switch to Morph by changing the base URL and API key — no request or response rewriting.
POST /v1/chat/completions instead; both routes serve the same models.Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
Anthropic-compatible message request
Anthropic-shaped Messages request served by a Morph model.
ID of the Morph model to use
"morph-glm52-744b"
Maximum number of tokens to generate before stopping
1024
Conversation turns, alternating between user and assistant, oldest first
System prompt applied ahead of the conversation
"You are a senior TypeScript engineer. Reply with code only."
Enable streaming response. When true the response is a text/event-stream of Anthropic-style message_start, content_block_delta, and message_stop events.
false
Sampling temperature for the Messages request (0.0 for deterministic output)
0
Response
Message response
Anthropic-shaped Messages response produced by a Morph model.
Unique identifier for the message
"msg_01XFDUDYJgAACzvnptvVoYEL"
Object type, always message
message "message"
The role of the message author, always assistant on a response
assistant "assistant"
Content blocks generated by the model
ID of the model that produced the message
"morph-glm52-744b"
Why the model stopped generating tokens
end_turn, max_tokens, stop_sequence "end_turn"
Token usage for the message