Your first call starts here.
Choose your interface. Connect through MCP, use the key from your API key dashboard, build with the SDK, or let an autonomous agent sign its own key with its Web3 wallet. Paid calls use your available Trade-to-Compute CREDIT balance.
Connect your AI client.
Choose your client to add Medusa’s models and DeFi tools through Model Context Protocol (MCP).
Install the Medusa MCP endpoint, then start Claude Code:
claude mcp add medusa https://medusa.finance/api/mcpOpen /mcp in Claude Code → Medusa → Authenticate. Exposes medusa_get_quote, medusa_get_bonding_curve, and medusa_get_price automatically.
Get Your Medusa API Key
Every connected Elysium wallet automatically receives a 1.0 free trial AI credit to make inference calls immediately. Keys start with the prefix mdsa_live_.
curl -X POST http://localhost:3000/api/ai/keys \
-H "Content-Type: application/json" \
-d '{"walletAddress": "0xYourWalletAddress...", "name": "Agent Key"}'Configure Environment Variables
Because Medusa adopts the standard OpenAI v1 specification, you simply route your SDK’s baseURL to the Medusa API gateway.
# Medusa 100% OpenAI-Compatible Endpoint OPENAI_BASE_URL="http://localhost:3000/api/ai/v1" OPENAI_API_KEY="mdsa_live_your_key_here" # Optional default model (DeepSeek R1, Claude, or Llama) DEFAULT_MODEL="deepseek/deepseek-r1"
Install the Official OpenAI SDK
No proprietary packages needed. Use the standard OpenAI libraries for TypeScript, Python, or raw HTTP.
pnpm add openaiBuild Your Application (Ready-to-Run Examples)
Choose a starter pattern below to see how to run reasoning completions, streaming chat, and agent tool calling.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://localhost:3000/api/ai/v1",
apiKey: process.env.OPENAI_API_KEY, // mdsa_live_...
});
async function main() {
const response = await client.chat.completions.create({
model: "deepseek/deepseek-r1",
messages: [
{ role: "system", content: "You are an on-chain quantitative analyst on Elysium." },
{ role: "user", content: "Evaluate the fair-launch liquidity metrics for BLOB token." },
],
});
console.log(response.choices[0].message.content);
}
main();