Skip to content

About

Zero-dependency Java 17+ and Kotlin SDK for the Nodecode API (Cyber v1, Decide v1, Image v1)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodecode-java

Zero-dependency Java 17+ and Kotlin client for the Nodecode API, built for Cyber v1 (nodecode-cyber-v1), Decide v1 (nodecode-decide-v1), and Image v1 (nodecode-image-v1).

Operated by Foresight Labs (EU entity) with zero data retention.

Why zero dependencies

Uses java.net.http.HttpClient and an internal RFC 8259 JSON codec only - no OkHttp, Jackson, Gson, or Kotlin stdlib transitive conflicts. Drops cleanly into Spring Boot services, Gradle/Maven projects, Burp Suite Montoya extensions, and OWASP ZAP add-ons.

Install

Published on Maven Central as ai.nodecode:nodecode-java:0.1.0.

Maven

<dependency>
  <groupId>ai.nodecode</groupId>
  <artifactId>nodecode-java</artifactId>
  <version>0.1.0</version>
</dependency>

Gradle (Kotlin DSL)

dependencies {
    implementation("ai.nodecode:nodecode-java:0.1.0")
}

Requires Java 17+.

Quickstart

Create an API key (sk-nc-...) at nodecode.ai/account/keys and set NODECODE_API_KEY:

import ai.nodecode.*;

public class Quickstart {
    public static void main(String[] args) {
        NodecodeClient client = NodecodeClient.create(); // reads NODECODE_API_KEY

        ChatCompletionResponse resp = client.chatCompletion(
            ChatCompletionRequest.builder()
                .model(NodecodeModels.CYBER_V1)
                .addUserMessage("22/tcp and 8080/tcp are open. What next, in order?")
                .maxTokens(600)
                .build()
        );

        System.out.println("Reasoning: " + resp.firstReasoning());
        System.out.println("Answer: " + resp.firstContent());
    }
}

Streaming (SSE)

ChatCompletionRequest req = ChatCompletionRequest.builder()
    .model(NodecodeModels.CYBER_V1)
    .addUserMessage("Audit this Dockerfile for privilege escalation.")
    .maxTokens(1024)
    .build();

try (ChatCompletionStream stream = client.chatCompletionStream(req)) {
    for (ChatCompletionChunk chunk : stream) {
        if (!chunk.choices().isEmpty()) {
            String delta = chunk.choices().get(0).delta().content();
            if (delta != null) {
                System.out.print(delta);
            }
        }
    }
}

Reasoning token budget

Cyber v1 thinks first, and maxTokens covers both thinking and final output. Passing a very small maxTokens (such as 100) can exhaust the budget during reasoning and return empty content with finishReason "length". Give calls at least a few hundred tokens.

Models, usage, and images

  • client.listModels() / client.getModel(NodecodeModels.CYBER_V1) - live model list and pricing (works without an API key, costs nothing).
  • client.usage() - remaining balance, plan allowance, and running concurrency slots (GET /v1/usage, costs nothing).
  • client.generateImage(req) - Image v1 (nodecode-image-v1) via POST /v1/images/generations with decodeBytes() for b64_json.
  • NodecodeException - unchecked API error with isInsufficientBalance(), isRateLimited(), isUnauthorized(), and parsed refill() metadata on HTTP 402.

Documentation

License

MIT. Copyright (c) 2026 Foresight Labs.

About

Zero-dependency Java 17+ and Kotlin SDK for the Nodecode API (Cyber v1, Decide v1, Image v1)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages