Skip to main content
Client options. Explicit values take precedence over environment variables, then SDK defaults.

Properties

apiKey?

Required API key; falls back to TYPESAFE_API_KEY.

baseURL?

API root; falls back to TYPESAFE_BASE_URL, then https://api.typesafe.ai.

compression?

Request body compression, sent as Content-Encoding. Default: "zstd" on runtimes that have it (Node.js 22.15 or newer), otherwise false. Bodies under 1 KiB are always sent uncompressed. Pass false to send all bodies uncompressed, for example to an API that doesn’t accept compressed requests.

dangerouslyAllowBrowser?

Allow browser use, exposing the API key to page users. Default: false.

defaultHeaders?

Additional request headers; per-call headers take precedence.

defaultModel?

Default model; falls back to TYPESAFE_DEFAULT_MODEL, then jev-latest.

fetch?

Custom HTTP fetch implementation for transport configuration or tests. Default: global fetch.

logger?

Logger filtered to logLevel and above. Default: prefixed console.

logLevel?

Log level; falls back to TYPESAFE_LOG_LEVEL, then warn. info logs request summaries; debug adds headers and bodies. Known credential headers are redacted; bodies are not.

retry?

Retry overrides; omitted fields use the defaults in RetryPolicy.

timeout?

Timeout per attempt in milliseconds, without a total retry budget. Default: 10000.