Skip to main content
The Dedalus SDK is configured through the ClientOptions interface when instantiating the client. All options are optional and can be set via constructor parameters or environment variables.

Basic Configuration

import { Dedalus } from 'dedalus-labs';

const client = new Dedalus({
  apiKey: 'your-api-key',
  environment: 'production',
  timeout: 30000,
  maxRetries: 2
});

ClientOptions Interface

apiKey
string | null
API key for Bearer token authentication.Defaults to process.env.DEDALUS_API_KEY
xAPIKey
string | null
API key for X-API-Key header authentication.Defaults to process.env.DEDALUS_X_API_KEY
organization
string | null
Organization ID for request scoping.Defaults to process.env.DEDALUS_ORG_ID
provider
string | null
Provider name for Bring Your Own Key (BYOK) mode.Defaults to process.env.DEDALUS_PROVIDER
providerKey
string | null
Provider API key for BYOK mode.Defaults to process.env.DEDALUS_PROVIDER_KEY
providerModel
string | null
Model identifier for BYOK provider.Defaults to process.env.DEDALUS_PROVIDER_MODEL
environment
'production' | 'development'
Specifies the environment to use for the API.Each environment maps to a different base URL:
  • production corresponds to https://api.dedaluslabs.ai
  • development corresponds to http://localhost:8080
Defaults to 'production'
baseURL
string | null
Override the default base URL for the API, e.g., "https://api.example.com/v2/"Defaults to process.env.DEDALUS_BASE_URL
Cannot be used together with the environment option. If you want to use an environment preset, pass baseURL: null
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.
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.
Defaults to 60000 (1 minute)
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.Defaults to 2
fetch
Fetch
Specify a custom fetch function implementation.If not provided, the SDK expects that fetch is defined globally.
fetchOptions
RequestInit
Additional RequestInit options to be passed to fetch calls.Properties will be overridden by per-request fetchOptions.
defaultHeaders
Record<string, string>
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.
logLevel
'debug' | 'info' | 'warn' | 'error' | 'silent'
Set the log level for SDK logging.Defaults to process.env.DEDALUS_LOG or 'warn' if not set.
logger
Logger
Set a custom logger implementation.Defaults to globalThis.console

Environment Variables

All configuration options can be set via environment variables:
OptionEnvironment Variable
apiKeyDEDALUS_API_KEY
xAPIKeyDEDALUS_X_API_KEY
organizationDEDALUS_ORG_ID
providerDEDALUS_PROVIDER
providerKeyDEDALUS_PROVIDER_KEY
providerModelDEDALUS_PROVIDER_MODEL
baseURLDEDALUS_BASE_URL
logLevelDEDALUS_LOG

Creating Modified Clients

Use withOptions() to create a new client instance with modified configuration:
const client = new Dedalus({ apiKey: 'key-1' });

// Create a new client with different options
const clientWithTimeout = client.withOptions({ 
  timeout: 120000 
});
The new client re-uses all options from the original client, with the specified options overridden.

Example Configurations

Production with Custom Timeout

const client = new Dedalus({
  apiKey: process.env.DEDALUS_API_KEY,
  environment: 'production',
  timeout: 30000, // 30 seconds
  maxRetries: 3
});

Development Environment

const client = new Dedalus({
  apiKey: 'dev-key',
  environment: 'development',
  logLevel: 'debug'
});

BYOK Configuration

const client = new Dedalus({
  apiKey: process.env.DEDALUS_API_KEY,
  provider: 'openai',
  providerKey: process.env.OPENAI_API_KEY,
  providerModel: 'gpt-4'
});

Custom Base URL

const client = new Dedalus({
  apiKey: 'your-api-key',
  baseURL: 'https://custom.api.example.com/v1'
});

Build docs developers (and LLMs) love