SDKs
Go SDK
Use the Public Preview Go SDK from backend agents, CLIs, and services.
The Go 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"
go get github.com/SynapseNetworkAI/Synapse-Network-Sdk/gopackage main
import (
"context"
"fmt"
"os"
synapse "github.com/SynapseNetworkAI/Synapse-Network-Sdk/go/synapse"
)
func main() {
environment := os.Getenv("SYNAPSE_ENV")
if environment == "" {
environment = "local"
}
client, err := synapse.NewClient(synapse.Options{
Credential: os.Getenv("SYNAPSE_AGENT_KEY"),
Environment: environment,
})
if err != nil {
panic(err)
}
services, err := client.Search(context.Background(), "svc_synapse_echo", synapse.SearchOptions{Limit: 10})
if err != nil {
panic(err)
}
service := services[0]
result, err := client.Invoke(
context.Background(),
service.ServiceID,
map[string]any{
"message": "hello from Synapse SDK smoke",
"metadata": map[string]any{"scenario": "quickstart"},
},
synapse.InvokeOptions{CostUSDC: fmt.Sprint(service.Pricing["amount"])},
)
if err != nil {
panic(err)
}
fmt.Println(result.InvocationID, result.Status, result.ChargedUSDC)
}Token-metered LLM calls
result, err := client.InvokeLLM(
context.Background(),
"svc_deepseek_chat",
map[string]any{
"messages": []map[string]string{{"role": "user", "content": "hello"}},
},
synapse.LLMInvokeOptions{MaxCostUSDC: "0.010000"},
)