Both SDKs wrap the same /v1 control plane. Pick the language you ship in, install it, then point the client at a Gatekeeper instance with a base URL (and an optional bearer token).
Requirements#
| SDK | Package | Runtime |
|---|---|---|
| TypeScript | @orkait/sdk | Node 18+, Bun, browsers, or Cloudflare Workers (anywhere fetch exists) |
| Python | gatekeeper-sdk | Python 3.9+ (uses httpx) |
Install#
The npm package is @orkait/sdk. Install with your package manager of choice.
# npm
npm install @orkait/sdk
# bun
bun add @orkait/sdkThe import module is @orkait/sdk:
import { GatekeeperCore, AuthService } from '@orkait/sdk';Point the client at an instance#
Every client is built over a single GatekeeperCore, which holds the base URL, an optional bearer token, and the transport. The base URL is the origin of your Gatekeeper deployment. The SDK appends the /v1 version prefix for you (and will not double it if your URL already ends in /v1).
-
Get the base URL of your Gatekeeper instance.
- Running locally with Bun:
http://localhost:8787(see the Quickstart). - Deployed to Cloudflare Workers: your
*.workers.devURL or custom domain.
- Running locally with Bun:
-
Construct a core with that base URL.
import { GatekeeperCore } from '@orkait/sdk'; const core = new GatekeeperCore({ baseUrl: 'https://gatekeeper-api.example.workers.dev', }); -
Optionally pass a token up front, or set it later with
setToken/set_tokenafter you log in.const core = new GatekeeperCore({ baseUrl: 'https://gatekeeper-api.example.workers.dev', token: 'an-access-token', });
Configure from environment#
Instead of hard-coding the base URL and token, build the core from environment variables. Both SDKs read the same two variables.
| Variable | Purpose |
|---|---|
GATEKEEPER_BASE_URL | Required. Origin of the Gatekeeper instance. |
GATEKEEPER_TOKEN | Optional. Bearer access token applied to authenticated calls. |
import { GatekeeperCore } from '@orkait/sdk';
// Reads GATEKEEPER_BASE_URL (+ GATEKEEPER_TOKEN if set). Overrides win.
const core = GatekeeperCore.fromEnv();Global configuration#
The core accepts a few global options applied to every request: a custom transport, a request timeout, default headers, and a user agent.
const core = new GatekeeperCore({
baseUrl: 'https://gatekeeper-api.example.workers.dev',
token: 'an-access-token',
timeoutMs: 10_000,
defaultHeaders: { 'x-trace': 'abc' },
userAgent: 'myapp/1.0',
});Pass fetch to supply a custom transport (a Workers service binding, a test SELF.fetch, or a mock).
Next, walk through your first end-to-end flow in the Quickstart.