Fetches a chat completion from Messari Copilot. Can handle all manner of domains: Market Data, News, Fundraising, Research, etc
1. Instantiate Client
First, instantiate the MessariSDK
from@messari/sdk-ts
. You’ll need to provide your API key during initialization or set it as an
environment variable.
2. Get Chat Completion
Next, use the client.ai.openai.chat.generateCompletion
method. Construct your message payload, specifying the user’s query. The
inlineCitations: true
option will embed source information
directly in the response if available.
3. Results
The response
object from the service will contain the chat
completion. The AI’s message is typically found in
response.choices[0].message.content
. The response includes
other metadata related to the completion, token usage, and any citations
(when requested).
For more details on response formats and additional features, see theMessari SDK-TS documentation.