Generate chat completions with Messari AI
curl --request POST \
--url https://api.messari.io/ai/v2/chat/completions \
--header 'Content-Type: application/json' \
--header 'X-Messari-API-Key: <api-key>' \
--data '
{
"messages": [
{
"role": "user",
"content": "What is Solana?"
}
],
"allow_clarification_query": true,
"generate_related_questions": 2,
"inline_citations": true,
"response_format": "markdown",
"stream": false,
"verbosity": "balanced"
}
'import requests
url = "https://api.messari.io/ai/v2/chat/completions"
payload = {
"messages": [
{
"role": "user",
"content": "What is Solana?"
}
],
"allow_clarification_query": True,
"generate_related_questions": 2,
"inline_citations": True,
"response_format": "markdown",
"stream": False,
"verbosity": "balanced"
}
headers = {
"X-Messari-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Messari-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: 'user', content: 'What is Solana?'}],
allow_clarification_query: true,
generate_related_questions: 2,
inline_citations: true,
response_format: 'markdown',
stream: false,
verbosity: 'balanced'
})
};
fetch('https://api.messari.io/ai/v2/chat/completions', 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://api.messari.io/ai/v2/chat/completions",
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([
'messages' => [
[
'role' => 'user',
'content' => 'What is Solana?'
]
],
'allow_clarification_query' => true,
'generate_related_questions' => 2,
'inline_citations' => true,
'response_format' => 'markdown',
'stream' => false,
'verbosity' => 'balanced'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Messari-API-Key: <api-key>"
],
]);
$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://api.messari.io/ai/v2/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Messari-API-Key", "<api-key>")
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://api.messari.io/ai/v2/chat/completions")
.header("X-Messari-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.messari.io/ai/v2/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Messari-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"messages": [
{}
]
},
"error": "<string>",
"metadata": {
"status": "<string>",
"trace_id": "aSDinaTvuI8gbWludGxpZnk=",
"charts": [
{}
],
"related_questions": [
"<string>"
],
"sources": [
{}
]
}
}{
"data": "<unknown>",
"error": "<string>"
}{
"data": "<unknown>",
"error": "<string>"
}{
"data": "<unknown>",
"error": "<string>"
}Copilot
Chat Completion - Messari v2
Messari v2 chat completion endpoint for contextual crypto responses.
POST
/
ai
/
v2
/
chat
/
completions
Generate chat completions with Messari AI
curl --request POST \
--url https://api.messari.io/ai/v2/chat/completions \
--header 'Content-Type: application/json' \
--header 'X-Messari-API-Key: <api-key>' \
--data '
{
"messages": [
{
"role": "user",
"content": "What is Solana?"
}
],
"allow_clarification_query": true,
"generate_related_questions": 2,
"inline_citations": true,
"response_format": "markdown",
"stream": false,
"verbosity": "balanced"
}
'import requests
url = "https://api.messari.io/ai/v2/chat/completions"
payload = {
"messages": [
{
"role": "user",
"content": "What is Solana?"
}
],
"allow_clarification_query": True,
"generate_related_questions": 2,
"inline_citations": True,
"response_format": "markdown",
"stream": False,
"verbosity": "balanced"
}
headers = {
"X-Messari-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Messari-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{role: 'user', content: 'What is Solana?'}],
allow_clarification_query: true,
generate_related_questions: 2,
inline_citations: true,
response_format: 'markdown',
stream: false,
verbosity: 'balanced'
})
};
fetch('https://api.messari.io/ai/v2/chat/completions', 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://api.messari.io/ai/v2/chat/completions",
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([
'messages' => [
[
'role' => 'user',
'content' => 'What is Solana?'
]
],
'allow_clarification_query' => true,
'generate_related_questions' => 2,
'inline_citations' => true,
'response_format' => 'markdown',
'stream' => false,
'verbosity' => 'balanced'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Messari-API-Key: <api-key>"
],
]);
$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://api.messari.io/ai/v2/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Messari-API-Key", "<api-key>")
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://api.messari.io/ai/v2/chat/completions")
.header("X-Messari-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.messari.io/ai/v2/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Messari-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is Solana?\"\n }\n ],\n \"allow_clarification_query\": true,\n \"generate_related_questions\": 2,\n \"inline_citations\": true,\n \"response_format\": \"markdown\",\n \"stream\": false,\n \"verbosity\": \"balanced\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"messages": [
{}
]
},
"error": "<string>",
"metadata": {
"status": "<string>",
"trace_id": "aSDinaTvuI8gbWludGxpZnk=",
"charts": [
{}
],
"related_questions": [
"<string>"
],
"sources": [
{}
]
}
}{
"data": "<unknown>",
"error": "<string>"
}{
"data": "<unknown>",
"error": "<string>"
}{
"data": "<unknown>",
"error": "<string>"
}x402 Support: Supported.
See the x402 guide.
Authorizations
Body
application/json
Array of messages in the conversation history
Show child attributes
Show child attributes
Whether the AI can ask for clarification when the query is ambiguous
Adds AI generated related questions to use as follow up questions
Adds inline citation document references in the payload metadata
Text format for the response. Values accepted are 'markdown' and 'plaintext'.
Stream the response through the API
Controls the length and detail level of the AI-generated response. Values accepted are 'succinct', 'balanced', and 'verbose'.
⌘I

