SDKs
Java/JVM SDK
Use the Public Preview Java SDK from Java 17, Kotlin, and JVM services.
The Java/JVM SDK is in Public Preview. Kotlin and other JVM languages can call the Java SDK directly.
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"
<dependency>
<groupId>ai.synapsenetwork</groupId>
<artifactId>synapse-network-sdk</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>import ai.synapsenetwork.sdk.SynapseClient;
import java.util.Map;
SynapseClient client = new SynapseClient(
SynapseClient.options(System.getenv("SYNAPSE_AGENT_KEY"))
.environment(System.getenv().getOrDefault("SYNAPSE_ENV", "local")));
var services = client.search("svc_synapse_echo", new SynapseClient.SearchOptions());
var service = services.get(0);
SynapseClient.InvokeOptions options = new SynapseClient.InvokeOptions();
options.costUsdc = service.pricing().path("amount").asText("0");
var result = client.invoke(
service.serviceId(),
Map.of(
"message", "hello from Synapse SDK smoke",
"metadata", Map.of("scenario", "quickstart")),
options);
System.out.println(result.invocationId() + " " + result.status() + " " + result.chargedUsdc());Token-metered LLM calls
SynapseClient.LlmInvokeOptions options = new SynapseClient.LlmInvokeOptions();
options.maxCostUsdc = "0.010000";
var result = client.invokeLlm(
"svc_deepseek_chat",
Map.of("messages", java.util.List.of(Map.of("role", "user", "content", "hello"))),
options);