SynapseDocumentation
SDKs

TypeScript SDK

Build Node and web agents that discover and invoke paid services.

The TypeScript SDK is in Public Preview. Public examples target the current docs environment shown below.

Current environment addresses

prod
Environment
prod
Gateway Base
https://api.synapse-network.ai
Console
https://www.synapse-network.ai/dashboard/overview
Docs
https://docs.synapse-network.ai
Chain
Arbitrum One (42161)
Explorer
https://arbiscan.io
export SYNAPSE_ENV="prod"
export GATEWAY_URL="https://api.synapse-network.ai"
npm install @synapse-network-ai/sdk
import { SynapseClient } from "@synapse-network-ai/sdk";

const agentKey = process.env.SYNAPSE_AGENT_KEY;
if (!agentKey) {
  throw new Error("SYNAPSE_AGENT_KEY is required");
}

const client = new SynapseClient({
  credential: agentKey,
  environment: process.env.SYNAPSE_ENV ?? "local",
});

const services = await client.search("svc_synapse_echo", {
  limit: 10,
});
const service = services[0];

const result = await client.invoke(
  service.serviceId ?? service.id!,
  {
    message: "hello from Synapse SDK smoke",
    metadata: { scenario: "quickstart" },
  },
  {
    costUsdc: String(service.pricing?.amount ?? "0"),
    idempotencyKey: "agent-job-001",
  }
);

const receipt = await client.getInvocation(result.invocationId);
console.log(receipt.invocationId, receipt.status, receipt.chargedUsdc);

Token-metered LLM calls

const llmResult = await client.invokeLlm(
  "svc_deepseek_chat",
  {
    messages: [{ role: "user", content: "Summarize this document." }],
    max_tokens: 512,
  },
  {
    maxCostUsdc: "0.010000",
    idempotencyKey: "llm-job-001",
  }
);

console.log(llmResult.usage, llmResult.synapse);

On this page