curl --request POST \
--url https://www.anyfast.ai/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
],
"max_tokens": 1024,
"system": "<string>",
"metadata": {
"user_id": "<string>"
},
"stop_sequences": [
"<string>"
],
"temperature": 1,
"top_p": 0.5,
"top_k": 1,
"stream": false,
"tools": [
{
"name": "<string>",
"input_schema": {},
"description": "<string>"
}
],
"tool_choice": {
"name": "<string>"
},
"output_config": {},
"thinking": {
"budget_tokens": 1025
}
}
'import requests
url = "https://www.anyfast.ai/v1/messages"
payload = {
"model": "claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
],
"max_tokens": 1024,
"system": "<string>",
"metadata": { "user_id": "<string>" },
"stop_sequences": ["<string>"],
"temperature": 1,
"top_p": 0.5,
"top_k": 1,
"stream": False,
"tools": [
{
"name": "<string>",
"input_schema": {},
"description": "<string>"
}
],
"tool_choice": { "name": "<string>" },
"output_config": {},
"thinking": { "budget_tokens": 1025 }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'claude-sonnet-5',
messages: [{role: 'user', content: 'Hello, Claude!'}],
max_tokens: 1024,
system: '<string>',
metadata: {user_id: '<string>'},
stop_sequences: ['<string>'],
temperature: 1,
top_p: 0.5,
top_k: 1,
stream: false,
tools: [{name: '<string>', input_schema: {}, description: '<string>'}],
tool_choice: {name: '<string>'},
output_config: {},
thinking: {budget_tokens: 1025}
})
};
fetch('https://www.anyfast.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.anyfast.ai/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'claude-sonnet-5',
'messages' => [
[
'role' => 'user',
'content' => 'Hello, Claude!'
]
],
'max_tokens' => 1024,
'system' => '<string>',
'metadata' => [
'user_id' => '<string>'
],
'stop_sequences' => [
'<string>'
],
'temperature' => 1,
'top_p' => 0.5,
'top_k' => 1,
'stream' => false,
'tools' => [
[
'name' => '<string>',
'input_schema' => [
],
'description' => '<string>'
]
],
'tool_choice' => [
'name' => '<string>'
],
'output_config' => [
],
'thinking' => [
'budget_tokens' => 1025
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.anyfast.ai/v1/messages"
payload := strings.NewReader("{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.anyfast.ai/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.ai/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "claude-sonnet-5",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123
},
"stop_sequence": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}Create Message
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
curl --request POST \
--url https://www.anyfast.ai/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
],
"max_tokens": 1024,
"system": "<string>",
"metadata": {
"user_id": "<string>"
},
"stop_sequences": [
"<string>"
],
"temperature": 1,
"top_p": 0.5,
"top_k": 1,
"stream": false,
"tools": [
{
"name": "<string>",
"input_schema": {},
"description": "<string>"
}
],
"tool_choice": {
"name": "<string>"
},
"output_config": {},
"thinking": {
"budget_tokens": 1025
}
}
'import requests
url = "https://www.anyfast.ai/v1/messages"
payload = {
"model": "claude-sonnet-5",
"messages": [
{
"role": "user",
"content": "Hello, Claude!"
}
],
"max_tokens": 1024,
"system": "<string>",
"metadata": { "user_id": "<string>" },
"stop_sequences": ["<string>"],
"temperature": 1,
"top_p": 0.5,
"top_k": 1,
"stream": False,
"tools": [
{
"name": "<string>",
"input_schema": {},
"description": "<string>"
}
],
"tool_choice": { "name": "<string>" },
"output_config": {},
"thinking": { "budget_tokens": 1025 }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'claude-sonnet-5',
messages: [{role: 'user', content: 'Hello, Claude!'}],
max_tokens: 1024,
system: '<string>',
metadata: {user_id: '<string>'},
stop_sequences: ['<string>'],
temperature: 1,
top_p: 0.5,
top_k: 1,
stream: false,
tools: [{name: '<string>', input_schema: {}, description: '<string>'}],
tool_choice: {name: '<string>'},
output_config: {},
thinking: {budget_tokens: 1025}
})
};
fetch('https://www.anyfast.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.anyfast.ai/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'claude-sonnet-5',
'messages' => [
[
'role' => 'user',
'content' => 'Hello, Claude!'
]
],
'max_tokens' => 1024,
'system' => '<string>',
'metadata' => [
'user_id' => '<string>'
],
'stop_sequences' => [
'<string>'
],
'temperature' => 1,
'top_p' => 0.5,
'top_k' => 1,
'stream' => false,
'tools' => [
[
'name' => '<string>',
'input_schema' => [
],
'description' => '<string>'
]
],
'tool_choice' => [
'name' => '<string>'
],
'output_config' => [
],
'thinking' => [
'budget_tokens' => 1025
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.anyfast.ai/v1/messages"
payload := strings.NewReader("{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.anyfast.ai/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.anyfast.ai/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"claude-sonnet-5\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Hello, Claude!\"\n }\n ],\n \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"top_k\": 1,\n \"stream\": false,\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"output_config\": {},\n \"thinking\": {\n \"budget_tokens\": 1025\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "claude-sonnet-5",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123
},
"stop_sequence": "<string>"
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}{
"type": "error",
"error": {
"type": "<string>",
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The model that will complete your prompt.
claude-sonnet-5, claude-sonnet-4-6, claude-sonnet-4-5-20250929, claude-sonnet-4-20250514, claude-opus-4-6, claude-opus-4-5-20251101, claude-opus-4-1-20250805, claude-opus-4-20250514, claude-haiku-4-5-20251001, claude-3-7-sonnet-20250219, claude-3-5-sonnet-20241022 "claude-sonnet-5"
Input messages. Each message has a role and content.
1Show child attributes
Show child attributes
[ { "role": "user", "content": "Hello, Claude!" } ]
The maximum number of tokens to generate before stopping.
x >= 11024
System prompt. Provides context and instructions to Claude.
An object describing metadata about the request.
Show child attributes
Show child attributes
Custom text sequences that will cause the model to stop generating.
Amount of randomness injected into the response. Ranges from 0.0 to 1.0.
0 <= x <= 11
Use nucleus sampling. Recommended to use either temperature or top_p, but not both.
0 <= x <= 1Only sample from the top K options for each subsequent token.
x >= 0Whether to incrementally stream the response using server-sent events.
Definitions of tools that the model may use.
Show child attributes
Show child attributes
How the model should use the provided tools.
Show child attributes
Show child attributes
Output controls for models that support adaptive thinking effort.
Show child attributes
Show child attributes
Thinking configuration. For Claude Sonnet 5, use adaptive thinking or disable thinking; manual extended thinking with budget_tokens is not supported.
Show child attributes
Show child attributes
Response
Message created successfully
"msg_01XFDUDYJgAACzvnptvVoYEL"
"message"
"assistant"
Show child attributes
Show child attributes
[ { "type": "text", "text": "Hello! How can I help you today?" } ]
"claude-sonnet-5"
Includes refusal when a request is declined.
end_turn, max_tokens, stop_sequence, tool_use, refusal, null Show child attributes
Show child attributes
Was this page helpful?