Messari SDK Examples

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.

Available Examples

GitHub Examples Repository

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.

AI Toolkit Examples

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
// Example: Basic AI chat completion with the Messari SDK
import { 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);
}

Getting Started

Before running these examples, make sure you have:
  1. Signed up for a Messari API key
  2. Installed the Messari SDK in your project:
npm install @messari/client
For full documentation on the SDK, refer to the Quickstart guide.

External Resources

For additional examples and source code, check out our SDK Examples Repository on GitHub.