Skip to main content
POST
/
v1
/
messages
Messages API
curl --request POST \
  --url https://api.unifically.com/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "max_tokens": 123,
  "messages": [
    {}
  ],
  "system": {},
  "stream": true,
  "temperature": 123,
  "top_p": 123,
  "stop_sequences": [
    {}
  ],
  "tools": [
    {}
  ],
  "tool_choice": {}
}
'
{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-4-6",
  "content": [
    {
      "type": "text",
      "text": "Quantum computing harnesses quantum mechanical phenomena..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 72
  }
}
The /v1/messages endpoint provides an Anthropic Messages API-compatible interface for text generation. Use the same request format as the Anthropic Messages API — swap the base URL to https://api.unifically.com and pass any supported model ID in the model field.
All LLM models support this endpoint, including Cursor, OpenAI, and Anthropic models.

Create Message

POST /v1/messages

Request

curl -X POST https://api.unifically.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain quantum computing in one paragraph."}
    ]
  }'

Request Parameters

model
string
required
Model identifier in provider/model-name format. See Available LLM Models.
max_tokens
integer
required
Maximum number of tokens to generate before stopping.
messages
array
required
Array of message objects with role (user or assistant) and content (string or content blocks array).
system
string | array
System prompt providing context and instructions to the model.
stream
boolean
If true, the response is streamed using server-sent events. Default: false.
temperature
number
Sampling temperature between 0 and 1.
top_p
number
Nucleus sampling parameter. Use either temperature or top_p, not both.
stop_sequences
array
Custom sequences that cause the model to stop generating.
tools
array
Definitions of tools the model may use. Each tool includes name, description, and input_schema.
tool_choice
object
Controls tool usage. Default: { "type": "auto" }.

System Prompt Example

curl -X POST https://api.unifically.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "openai/gpt-5.4",
    "max_tokens": 512,
    "system": "You are a helpful coding assistant. Be concise.",
    "messages": [
      {"role": "user", "content": "What is a closure in JavaScript?"}
    ]
  }'

Response

{
  "id": "msg_abc123",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-4-6",
  "content": [
    {
      "type": "text",
      "text": "Quantum computing harnesses quantum mechanical phenomena..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 72
  }
}

Streaming Response

When stream: true, the API returns text/event-stream with Anthropic-compatible event types (message_start, content_block_delta, message_stop, etc.):
curl -X POST https://api.unifically.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "cursor/composer-2.5-fast",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Supported Models

ModelProvider
cursor/composer-2.5Cursor
cursor/composer-2.5-fastCursor
openai/gpt-5.4-miniOpenAI
openai/gpt-5.4-nanoOpenAI
openai/gpt-5.4OpenAI
openai/gpt-5.5OpenAI
anthropic/claude-sonnet-4-6Anthropic
anthropic/claude-opus-4-6Anthropic
anthropic/claude-opus-4-7Anthropic
anthropic/claude-opus-4-8Anthropic
See individual model pages under LLM Models for details.

SDK Compatibility

Point the Anthropic SDK at Unifically by changing the base URL:
import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.unifically.com"
)

message = client.messages.create(
    model="anthropic/claude-opus-4-7",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)
print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.UNIFICALLY_API_KEY,
  baseURL: "https://api.unifically.com",
});

const message = await client.messages.create({
  model: "anthropic/claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }],
});