These examples demonstrate how to use the Messari SDK to build applications that leverage Messari’s powerful APIs. The examples are designed to show you common use cases and best practices for integrating Messari data into your applications.
For more comprehensive examples, including full TypeScript source code, check out our MessariKit repository on GitHub. The repository contains numerous examples showing how to use different aspects of the Messari SDK.
Our AI Toolkit examples demonstrate how to use Messari’s AI capabilities, including:
Setting up the SDK for AI API calls
Creating AI chat completions with domain-specific knowledge
Extracting entities from text
Customizing AI behavior with system prompts
Copy
Ask AI
// Example: Basic AI chat completion with the Messari SDKimport { MessariClient } from "@messari/client";const client = new MessariClient({ apiKey: "YOUR_API_KEY" });async function getChatResponse() { const response = await client.ai.chat.create({ messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "What is the current state of DeFi?" }, ], model: "messari-1", }); console.log(response.choices[0].message.content);}