Skip to main content
The Figranium class takes a single options object. Every option is optional; the SDK falls back to sensible defaults so a local install works with new Figranium({ apiKey }).

Constructor options

string
Absolute URL of your Figranium server. Must use http or https. Trailing slashes are trimmed. Defaults to http://localhost:11345.
string
API key sent as Authorization: Bearer <key> by default. Create keys from the Figranium web UI.
string
Header name for the API key. Either "authorization" (default) or "x-api-key".
number
Client-wide default timeout for non-stream requests, in milliseconds. Defaults to 30_000 (30 seconds). Streams have no default timeout.
function
Any fetch-compatible implementation. Useful for tracing, retries, cookie jars, test doubles, or proxying through instrumented HTTP clients.
HeadersInit
Default headers merged into every request. Per-call headers override these.

Option details

baseUrl

apiKey and apiKeyHeader

Pass apiKey to authenticate every request with an API key. By default the key is sent as Authorization: Bearer <key>. Set apiKeyHeader: "x-api-key" if your deployment expects that header.
See Authentication for how to create and manage API keys.

timeoutMs

Client-wide default timeout for non-stream requests, in milliseconds. Defaults to 30_000 (30 seconds). Streams have no default timeout; set a per-call timeoutMs if you want a terminal deadline.
Individual requests can override this per call with { timeoutMs }. See Request options.

fetch

Provide any fetch-compatible implementation. Useful for tracing, retries, cookie jars, test doubles, or proxying through instrumented HTTP clients.

headers

Default headers merged into every request. Per-call headers override these.

Complete example

Client resources

The Figranium instance exposes one property per resource, plus a few top-level convenience helpers. Top-level shortcuts:
  • figranium.runTask(id, input?) proxies to tasks.run.
  • figranium.scrape(input) proxies to execution.scrape.
  • figranium.agent(input) proxies to execution.agent.
  • figranium.headful(input) proxies to execution.headful.