SynapseDocumentation
SDKs

Python SDK

Use Synapse from Python agents, workers, and provider tooling.

The Python 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"
pip install synapse-client
import os

from synapse_client import SynapseClient

agent_key = os.environ["SYNAPSE_AGENT_KEY"]

client = SynapseClient(
    api_key=agent_key,
    environment=os.environ.get("SYNAPSE_ENV", "local"),
)

services = client.search("svc_synapse_echo", limit=10)
service = services[0]

result = client.invoke(
    service.service_id,
    {
        "message": "hello from Synapse SDK smoke",
        "metadata": {"scenario": "quickstart"},
    },
    cost_usdc=str(service.price_usdc),
    idempotency_key="agent-job-001",
)

receipt = client.get_invocation(result.invocation_id)
print(receipt.invocation_id, receipt.status, receipt.charged_usdc)

Token-metered LLM calls

llm_result = client.invoke_llm(
    "svc_deepseek_chat",
    {
        "messages": [{"role": "user", "content": "Summarize this document."}],
        "max_tokens": 512,
    },
    max_cost_usdc="0.010000",
    idempotency_key="llm-job-001",
)

print(llm_result.usage, llm_result.synapse)

On this page