Create a message (Anthropic Messages API)
POST
/messages
const url = 'https://api.saygm.com/v1/messages';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.saygm.com/v1/messages \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{}'Anthropic-compatible Messages API. Use the Anthropic SDK with base_url set to https://api.saygm.com; the request and response bodies match the Anthropic Messages schema. Pass the GM API key using Anthropic’s native x-api-key header.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
Examplegenerated
{}Responses
Section titled “Responses”An Anthropic Messages object, or a text/event-stream when stream is true.
object
Examplegenerated
{}string
Invalid request (e.g. unknown model).
Media typeapplication/json
object
error
object
message
string
type
string
code
string | null
Examplegenerated
{ "error": { "message": "example", "type": "example", "code": "example" }}