Skip to main content
Joip publishes two small, auditable clients for the live Captions API v1. Each is one file with no dependencies: download it, read it, and pin it in your repository. Both cover every v1 operation and add what a production integration needs: automatic retries, timeouts, paginators, one-call caption helpers, rate-limit info and structured errors. Both talk to https://api.joip.io; pass baseUrl (base_url in Python) only for controlled testing.
Server-side only. The files are source distributions, not browser bundles or registry packages. Load JOIP_API_KEY from server-side secret storage and never import a client into code that runs in a browser or mobile app.

JavaScript SDK

ESM for Node.js 22 and compatible server runtimes.

TypeScript types

Complete declarations for joip.js. Save beside it.

Python SDK

Standard library only, Python 3.9 and newer.

Install

Caption in one call

captions() and rewrite() submit the job, wait for it, and return { job, captions }. captions has one { index, text, error } per input, in input order: text is the caption, or null with an error when that image failed.
Pass a list of URLs instead of a body for the default joi style: joip.captions([url1, url2]). A helper throws JoipJobHeldError when the job reaches needs_review; the error carries job and the partial captions. Keep the job ID and never resubmit it under a new key. Each helper generates one Idempotency-Key for its submission. Pass idempotencyKey (idempotency_key in Python) to tie it to your own record, so a retried call can never pay twice. The JavaScript helpers take wait: { timeoutMs, intervalMs, maxIntervalMs }; the Python helpers take wait_timeout in seconds.

Retries and timeouts

Every request retries automatically on 429, 503, timeouts and network failures, up to maxRetries times (default 2). A Retry-After header is honoured exactly; without one the client backs off exponentially with jitter from 0.5 seconds. Other 4xx responses are never retried. A retried job submission is always safe: the client sends the same Idempotency-Key on every attempt, so Joip returns the original job instead of creating a second one.
A Retry-After longer than maxRetryDelayMs (default 30 seconds) is thrown straight away rather than slept on, so an hourly admission limit never blocks your process. Catch it and schedule the retry yourself.

Paginators

The iterators follow next_cursor for you, 100 resources per page.

Polling

waitForJob and wait_for_job poll from one second, backing off to five, until the job is terminal or held. They return the job with its items included (pass includeItems: false / include_items=False to skip them). A needs_review job is returned at once, because reconciling an ambiguous provider outcome takes far longer than a polling loop; check state before reading results. Past timeoutMs (default two minutes) they throw JoipTimeoutError.

Errors, replays and rate limits

Every non-2xx response throws JoipApiError (Python raises it). It carries: retryable follows the error catalog. The client already retried 429 and 503 before throwing; retry idempotency_in_progress, internal_error and the 502 codes yourself with the same key. All errors the SDK throws on purpose extend JoipError: JoipApiError, JoipTimeoutError and JoipJobHeldError. The client also keeps what the last response said:
In JavaScript replayed is non-enumerable, so it never ends up in JSON.stringify. In Python every response is a dict subclass with status, request_id, replayed and rate_limit attributes.

Every method

Every JavaScript request method also takes signal, timeoutMs and maxRetries; every Python request method takes timeout in seconds.

Versioning and verification

The file header and VERSION (__version__ in Python) name the SDK version; requests send User-Agent: joip-js/0.2.0 or joip-python/0.2.0. Pin a reviewed copy and commit it, or its checksum, so a client change is always explicit. Joip keeps the v1 wire contract stable: a breaking change gets a new versioned route, never a silent SDK change.
Verify the downloaded file
Version 0.2.0 is a drop-in upgrade from 0.1. Two values changed type: retryAfter / retry_after is now a number of seconds instead of the raw header string, and waitForJob now backs off and includes items by default.
Joip doesn’t publish registry packages. The files above are the official clients; packages named like Joip on npm or PyPI aren’t endorsed.