dydt.aiTerminalTerminalDevelopers
DocsAPI referenceChangelog
Open terminalGet API key

GET STARTED

OverviewQuickstartCore concepts

REFERENCE

HTTP endpointsWebSocket streams

ACCOUNT

API keysPricing and billing

GUIDES

AI agentsBuild your own agentChart embedChangelog

SPECS

OpenAPI JSON ↗AsyncAPI JSON ↗
Developers/Guides

Build your own agent

Every dydt endpoint is read-only, so each one maps cleanly to an agent tool. Not a developer? Connect an existing agent in five minutes instead.

Get a free API key →Use an existing agent

How it works

A model cannot fetch data on its own. You describe dydt endpoints to it as tools. When a question needs live data, the model replies with the tool it wants and the input to use. Your app makes the request, hands the JSON back, and the model answers from it. It can call several tools before it answers.

REPEATS WHILE CLAUDE ASKS FOR TOOLSUserasks in plain wordsYour appruns the loopClaudedecides what to calldydt APIlive on-chain data1"Red flags on this token?"2question + tool list3get_token({ token_address })4GET /tokens/:address + your API key5JSON: holders, creator, liquidity6tool_result7answer from the data8answer with timestamps
  1. User → Your app"Red flags on this token?"
  2. Your app → Claudequestion + tool list
  3. Repeats while Claude asks for toolsClaude → Your appget_token({ token_address })
  4. Your app → dydt APIGET /tokens/:address + your API key
  5. dydt API → Your appJSON: holders, creator, liquidity
  6. Your app → Claudetool_result
  7. Claude → Your appanswer from the data
  8. Your app → Useranswer with timestamps
Tool calldydt API requestClaude never calls the API itself; your app does.

Generate tools from OpenAPI

/openapi.json describes every endpoint with typed, validated parameters. Most agent frameworks can turn an OpenAPI operation into a tool directly.

Write a tool by hand

Copy the parameter schema into a tool definition:

Tool definition
{
  "name": "get_token",
  "description": "On-chain data and metadata for one Solana token, by mint address.",
  "input_schema": {
    "type": "object",
    "properties": {
      "token_address": { "type": "string", "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$" }
    },
    "required": ["token_address"]
  }
}

The model only sees the tool name and its input. Your handler adds the key and calls the API, so the key never enters a prompt or a transcript.

Tool handler
const API = "https://data.dydt.ai/v1";

export async function get_token({ token_address }) {
  const response = await fetch(`${API}/tokens/${token_address}`, {
    headers: { Authorization: `Bearer ${process.env.DYDT_API_KEY}` },
  });
  const body = await response.json();
  if (body.code !== 0) return { error: body.error, message: body.message };
  return body.data;
}
What Claude seesTool names and descriptionsInput schemasThe inputs it writesThe JSON you returnWhat stays on your serverDYDT_API_KEYThe HTTP requestRetries and rate limitsWhat to send backtool inputJSON result
What Claude sees
  • Tool names and descriptions
  • Input schemas
  • The inputs it writes
  • The JSON you return
What stays on your server
  • DYDT_API_KEY
  • The HTTP request
  • Retries and rate limits
  • What to send back

Run the loop

This example uses the Anthropic SDK (npm install @anthropic-ai/sdk). Put the tool definition and handler in dydt-tools.js, exported as getTokenTool and get_token. The loop sends the question with the tools, runs every tool the model asks for, returns the results, and stops when the model answers in text.

agent.js
import Anthropic from "@anthropic-ai/sdk";
import { getTokenTool, get_token } from "./dydt-tools.js";

const client = new Anthropic();
const handlers = { get_token };
const system =
  "Answer from dydt data only. Quote when the data was observed. Never give financial advice.";

export async function ask(question) {
  const messages = [{ role: "user", content: question }];

  while (true) {
    const response = await client.messages.create({
      model: "claude-opus-5",
      max_tokens: 16000,
      system,
      tools: [getTokenTool],
      messages,
    });
    messages.push({ role: "assistant", content: response.content });

    if (response.stop_reason !== "tool_use") {
      return response.content
        .filter(block => block.type === "text")
        .map(block => block.text)
        .join("");
    }

    const results = [];
    for (const block of response.content) {
      if (block.type !== "tool_use") continue;
      const output = await handlers[block.name](block.input);
      results.push({
        type: "tool_result",
        tool_use_id: block.id,
        content: JSON.stringify(output),
      });
    }
    messages.push({ role: "user", content: results });
  }
}

console.log(await ask("What are the red flags on TOKEN_ADDRESS?"));

Set ANTHROPIC_API_KEY and DYDT_API_KEY, then run node agent.js. Other model providers use the same pattern under names such as function calling.

Start with a few tools

Small, specific tools are easier for a model to choose between.

Find a tokenSearch tokens, then confirm the mint with the user.→Describe a tokenToken details plus holder structure.→Describe a marketPool metrics and recent candles.→Explain activityRecent trades and top traders for a token.→Profile a walletWallet stats, open positions, and trades with PnL.→Follow smart moneyWhat KOLs and smart wallets are trading now.→Discover tokensRanked feeds and the token signal feed.→

Rules for accurate answers

  • Resolve tokens by mint address. Several tokens can share a symbol.
  • Quote the time of the data, and say when a field is missing instead of guessing.
  • Present signals and rankings as observed data, not as advice to buy or sell.
  • Keep the API key in the tool runtime, never in the prompt or model output.
  • Never give the agent signing keys, seed phrases, or wallet permissions.