⌘K
SDK Installation
Install and configure the AskVerdict TypeScript SDK for Node.js, Bun, and browser environments.
1 min read
Share
The AskVerdict TypeScript SDK provides a type-safe client for the AskVerdict API.
Install
bash
npm install @askverdict/sdkQuick Setup
typescript
import { AskVerdictClient } from "@askverdict/sdk";
const client = new AskVerdictClient({
apiKey: process.env.ASKVERDICT_API_KEY!,
});
// Create a verdict
const result = await client.createVerdict({
question: "Should we adopt TypeScript for our Python team?",
mode: "balanced",
});
console.log(result.debate.id);Configuration Options
typescript
const client = new AskVerdictClient({
// Required
apiKey: "vrd_your_api_key",
// Optional
baseUrl: "https://api.askverdict.ai", // Custom base URL
timeout: 30000, // Request timeout in ms
});| Name | Type | Required | Description |
|---|---|---|---|
apiKey | string | Required | Your AskVerdict API key (starts with vrd_). |
baseUrl | string | Optional | API base URL. Default: https://api.askverdict.ai |
timeout | number | Optional | Request timeout in milliseconds. Default: 30000. |
Environment Variables
The SDK reads from environment variables as fallback:
bash
ASKVERDICT_API_KEY=vrd_your_api_key
ASKVERDICT_BASE_URL=https://api.askverdict.aiTypeScript Support
The SDK ships with full TypeScript types. No @types/ package needed.
typescript
import type {
CreateDebateParams,
DebateResponse,
Verdict,
DebateMode,
} from "@askverdict/sdk";Next Steps
- Client Methods — Full method reference
- Streaming — Real-time event streaming
- TypeScript Types — Type definitions
Was this page helpful?