For AI agents: a documentation index is available at https://www.plungeai.com/docs/llms.txt. Append .md to any page URL, or send Accept: text/markdown, to get markdown. Setup instructions for agents are at https://www.plungeai.com/docs/agents.md. One ozk_ key opens every plane, models included.

Documentation Index: fetch the complete documentation index at /llms.txt. Use this file to discover all available pages before exploring further.

The official TypeScript SDK for the PlungeAI One API (https://api.plungeai.com). Targets One API 2.5.0; package version 1.0.0. The resource methods and their types are generated from the API's own OpenAPI document (GET /v1/openapi.json). Zero runtime dependencies.

Release status: npm view @plungeai/one-api version; until it answers, build from sdk/one-api-client/ (npm ci && npm run build).

Installation

npm install @plungeai/one-api

Usage

import PlungeAI from '@plungeai/one-api'

const client = new PlungeAI({
	apiKey: process.env['PLUNGEAI_API_KEY'], // the default; can be omitted
})

const me = await client.whoami()
const run = await client.agents.execute('calculator-agent', { prompt: '6*7' })
const hits = await client.discovery.search({ q: 'web search', kind: 'agents' })

Streaming responses

const stream = await client.workflows.executeInlineStream({ workflow })
for await (const event of stream) {
	if (event.event === 'token') process.stdout.write((event.data as { delta: string }).delta)
}

break out of the loop or call stream.controller.abort() to stop; either aborts the underlying request. stream.tee() splits a stream in two, stream.toReadableStream() hands it on as a web ReadableStream. Methods that take stream: true (client.agents.execute, client.chat.completions.create) return the same Stream.

Auto-pagination

for await (const w of client.workflows.list({ kind: 'bot' })) {
	console.log(w)
}

let page = await client.workflows.list({ limit: 50 })
for (const w of page.data) console.log(w)
while (page.hasNextPage()) {
	page = await page.getNextPage()
	for (const w of page.data) console.log(w)
}

Handling errors

try {
	await client.agents.execute('calculator-agent', { prompt: '6*7' })
} catch (err) {
	if (err instanceof PlungeAI.FailedDependencyError) console.log(err.connect?.link)
	else if (err instanceof PlungeAI.APIError) console.log(err.status, err.code, err.requestID)
	else throw err
}
StatusError class
400BadRequestError
401AuthenticationError
403PermissionDeniedError
404NotFoundError
409ConflictError
422UnprocessableEntityError
424FailedDependencyError — connect: { provider, method, link } says where to connect the missing account
429RateLimitError
≥ 500InternalServerError
no responseAPIConnectionError (APIConnectionTimeoutError on timeout)

Every class is exported by name and as a static on PlungeAI. err.code is the envelope's error.code; err.requestID is the x-request-id header.

Retries

Failed requests are retried 2 times by default with short exponential backoff (honouring Retry-After): connection errors, timeouts, 408, 429 and ≥ 500. 409 and 424 are never retried — on the One API they are semantic answers (approval_required, duplicate_execution_id, a missing connection), and a retried execute would start a second run. Set maxRetries on the client or per request:

const client = new PlungeAI({ maxRetries: 0 })
await client.agents.execute('calculator-agent', { prompt: '6*7' }, { maxRetries: 5 })

idempotencyKey (per request) is sent as x-trace-id, the API's idempotency key: it becomes the run's execution id, is re-sent on every retry of the call, and a replay answers 409 duplicate_execution_id.

Timeouts

Requests time out after 10 minutes by default and throw APIConnectionTimeoutError (retried as above). Set timeout in milliseconds on the client or per request: new PlungeAI({ timeout: 20_000 }), client.whoami({ timeout: 5_000 }).

Models plane

client.chat.completions.create (plus client.embeddings and client.models) covers the OpenAI-compatible routes here; the OpenAI SDK also works with baseURL: 'https://api.plungeai.com/v1' and the same key.

Requirements

Node.js 20+, Deno, Bun, Cloudflare Workers and Vercel Edge. Browsers are refused unless you pass dangerouslyAllowBrowser: true, because a browser client exposes your ozk_ key to anyone who loads the page.

Planned: TI-34

The docs assistant is not available yet. You can hand these docs to your own assistant instead.