Skip to main content

Overview

The ClientOptions interface defines all configuration options available when creating a new Dedalus client instance. These options control authentication, API endpoints, network behavior, and logging.

Type Definition

export interface ClientOptions {
  apiKey?: string | null | undefined;
  xAPIKey?: string | null | undefined;
  organization?: string | null | undefined;
  provider?: string | null | undefined;
  providerKey?: string | null | undefined;
  providerModel?: string | null | undefined;
  environment?: Environment | undefined;
  baseURL?: string | null | undefined;
  timeout?: number | undefined;
  fetchOptions?: MergedRequestInit | undefined;
  fetch?: Fetch | undefined;
  maxRetries?: number | undefined;
  defaultHeaders?: HeadersLike | undefined;
  defaultQuery?: Record<string, string | undefined> | undefined;
  logLevel?: LogLevel | undefined;
  logger?: Logger | undefined;
}

Properties

Authentication Options

apiKey
string | null
API key for Bearer token authentication.Environment Variable: DEDALUS_API_KEY
xAPIKey
string | null
API key for X-API-Key header authentication.Environment Variable: DEDALUS_X_API_KEY
organization
string | null
Organization ID for request scoping.Environment Variable: DEDALUS_ORG_ID

BYOK (Bring Your Own Key) Options

provider
string | null
Provider name for BYOK mode (e.g., “openai”, “anthropic”).Environment Variable: DEDALUS_PROVIDER
providerKey
string | null
Provider API key for BYOK mode.Environment Variable: DEDALUS_PROVIDER_KEY
providerModel
string | null
Model identifier for BYOK provider.Environment Variable: DEDALUS_PROVIDER_MODEL

API Endpoint Configuration

environment
'production' | 'development'
Specifies the environment to use for the API.Each environment maps to a different base URL:
  • productionhttps://api.dedaluslabs.ai
  • developmenthttp://localhost:8080
Default: production
baseURL
string | null
Override the default base URL for the API.Example: "https://api.example.com/v2/"Environment Variable: DEDALUS_BASE_URL
Cannot be used together with environment. If you want to use the environment setting, pass baseURL: null.

Network Configuration

timeout
number
The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.Default: 60000 (1 minute)Unit: milliseconds
Request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.
maxRetries
number
The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.Default: 2
fetchOptions
MergedRequestInit
Additional RequestInit options to be passed to fetch calls. Properties will be overridden by per-request fetchOptions.
fetch
Fetch
Specify a custom fetch function implementation.If not provided, the client expects that fetch is defined globally.

Default Request Options

defaultHeaders
HeadersLike
Default headers to include with every request to the API.These can be removed in individual requests by explicitly setting the header to null in request options.
defaultQuery
Record<string, string | undefined>
Default query parameters to include with every request to the API.These can be removed in individual requests by explicitly setting the param to undefined in request options.

Logging Options

logLevel
LogLevel
Set the log level.Environment Variable: DEDALUS_LOGDefault: 'warn'Valid Values: 'debug' | 'info' | 'warn' | 'error'
logger
Logger
Set the logger instance.Default: globalThis.console

Usage Example

import { Dedalus } from 'dedalus-labs';

const client = new Dedalus({
  apiKey: 'your-api-key',
  organization: 'org-123',
  timeout: 30000,
  maxRetries: 3,
  logLevel: 'info',
});

Environment Variables

The following environment variables are automatically read if the corresponding options are not provided:
Environment VariableMaps to OptionDescription
DEDALUS_API_KEYapiKeyBearer token authentication
DEDALUS_X_API_KEYxAPIKeyX-API-Key header authentication
DEDALUS_ORG_IDorganizationOrganization ID
DEDALUS_PROVIDERproviderBYOK provider name
DEDALUS_PROVIDER_KEYproviderKeyBYOK provider API key
DEDALUS_PROVIDER_MODELproviderModelBYOK model identifier
DEDALUS_BASE_URLbaseURLCustom base URL
DEDALUS_LOGlogLevelLogging level

See Also

Build docs developers (and LLMs) love