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.
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.
- User → Your app
"Red flags on this token?" - Your app → Claude
question + tool list - Repeats while Claude asks for toolsClaude → Your app
get_token({ token_address }) - Your app → dydt API
GET /tokens/:address + your API key - dydt API → Your app
JSON: holders, creator, liquidity - Your app → Claude
tool_result - Claude → Your app
answer from the data - Your app → User
answer with timestamps
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:
{ "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.
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; }
- Tool names and descriptions
- Input schemas
- The inputs it writes
- The JSON you return
- 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.
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.
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.