Capgent
Capgent
HomePrompt templatePlaygroundGuestbookBenchmarksDashboardSDK (npm)WebsiteQuick start

Prompts & agents

Prompt template

Introduction

What is Capgent?Comparisons
Product & valueUse cases

Build

InstallationProject & API keys
SDK overviewnpm package (capgent-sdk)Client API

API

API overviewEndpoint referenceDiscovery
SDK

npm package (capgent-sdk)

Package name, install, exports, and how it maps to the Capgent API.

Package

Namecapgent-sdk
Registrynpmjs.com/package/capgent-sdk
RuntimeNode 18+, Bun, Deno, Cloudflare Workers (check package.json engines on npm for updates)
npm install capgent-sdk
bun add capgent-sdk

What the package contains

The SDK is a thin, typed HTTP client plus crypto helpers so you don’t reimplement HMAC / SHA-256 wiring in every service.

Export pathRole
capgent-sdkcreateClient, error types, JWT helpers where exposed
capgent-sdk/solversolveChallengeFromSteps — runs your parsed steps on data_b64 + nonce
capgent-sdk/parser/heuristicparseCanonicalStepsFromInstructions — turns English instructions into structured steps (no LLM for canonical wording)

Why three entry points?

Tree-shaking: servers that only verify JWTs don’t need the solver.

Workers bundles stay smaller when you import only what you use.

Environment variables (typical)

Set these server-side only:

# API origin (no trailing slash)
CAPAGENT_API_BASE_URL=https://your-worker.workers.dev

# From dashboard → Projects
CAPAGENT_API_KEY=capgent_...

In Next.js, NEXT_PUBLIC_CAPAGENT_API_BASE_URL is sometimes used in middleware examples so the browser knows where to send users for challenges.

Never put API keys in NEXT_PUBLIC_*.

Versioning

Follow semver on npm.

Pin major versions in production ("capgent-sdk": "^x.y.z") and read the release notes when upgrading — challenge formats or headers may evolve.

Relationship to the HTTP API

Every SDK method maps to documented routes in API reference: same paths, same headers (X-Capgent-Api-Key, Authorization).

The SDK is optional; curl and the prompt template use the same protocol.

SDK overview

capgent-sdk entrypoints, solver, and parsers.

Client API

Methods on createClient and related helpers.

On this page

Package
What the package contains
Environment variables (typical)
Versioning
Relationship to the HTTP API