Skip to main content
The current CLI experience is centered on interactive mode. For one-shot/scripted usage, use the SDK or HTTP endpoint directly.

Option 1: SDK one-shot call

import { DZapSDK } from "@dzapio/ai";

const sdk = new DZapSDK();
await sdk.initialize({ startupPassword: process.env.DZAP_STARTUP_PASSWORD });

const result = await sdk.ask({
  userQuery: "Price of ETH and BTC on Ethereum",
  metadata: {
    accountInfo: [{ blockchain: "evm", chain: "1", user_account: "0xabc..." }],
  },
});

console.log(result.finalText);

Option 2: HTTP /ask (NLWeb-compatible)

Use POST /ask for request/response flows:
curl -X POST "https://nlp-ai-439689868940.europe-north1.run.app/ask" \
  -H "Content-Type: application/json" \
  -d "{\"query\":\"Show ETH price\",\"session_id\":\"script-1\",\"context\":{\"accountInfo\":[{\"blockchain\":\"evm\",\"chain\":\"1\",\"user_account\":\"0xabc...\"}]}}"
Expected JSON shape:
{
  "_meta": {
    "response_type": "answer",
    "version": "1.0"
  },
  "output": {
    "text": "ETH price is ..."
  }
}

Option 3: Streaming /ask with SSE

Set prefer.streaming: true to stream start, result, and complete events.
curl -N -X POST "https://nlp-ai-439689868940.europe-north1.run.app/ask" \
  -H "Content-Type: application/json" \
  -d "{\"query\":\"Show ETH price\",\"session_id\":\"script-1\",\"prefer\":{\"streaming\":true},\"context\":{\"accountInfo\":[{\"blockchain\":\"evm\",\"chain\":\"1\",\"user_account\":\"0xabc...\"}]}}"
Response headers include Content-Type: text/event-stream.

When to use which mode

ModeBest for
Interactive CLIManual workflows and confirmations
SDKBackend services and typed Node apps
HTTP /askLanguage-agnostic request/response
HTTP /ask + SSEReal-time streamed agent output
Last modified on May 30, 2026