Configuration
Configure request defaults, custom transport behavior, headers, and advanced client settings in `@orcushq/deepseek`. Feature-specific options are documented alongside their related features.
DeepSeekWeb supports client-wide configuration and per-call overrides. Client-wide options establish defaults, while supported per-call options can override those defaults for an individual operation. Configuration details and method-specific limitations are documented below.
Request options
searchEnabled
searchEnabled controls the default search_enabled value in the request payload. When omitted, the SDK sends false. You can override the client default for an individual invocation by passing searchEnabled in the per-call options.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, searchEnabled: false,}) // Override the client default for this invocation.const response = await model.invoke('Find recent information about TypeScript.', { searchEnabled: true,}) console.log(response.content)Verified: without an explicit setting, the request payload contains search_enabled: false. Passing searchEnabled: true to invoke() overrides a client default of false.
Transport options
fetchImpl
fetchImpl accepts a Fetch-compatible implementation and is configured when constructing the client. If omitted, the SDK uses globalThis.fetch. Injecting a custom implementation is useful for testing, custom transports, and environments that provide their own Fetch implementation.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, fetchImpl: customFetch,}) const response = await model.invoke('Hello!') console.log(response.content)Verified: the injected fetchImpl receives transport requests made by the SDK. The test suite also confirms that configured custom headers are present on captured requests.
defaultHeaders
defaultHeaders lets you add custom headers to transport requests. For example, you can attach an application identifier for debugging or request tracing. The SDK also constructs authentication and protocol headers internally, so avoid using defaultHeaders to override headers managed by the SDK.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, defaultHeaders: { 'X-Client-Name': 'my-application', },})Avoid overriding managed headers
Header merging can be case-sensitive internally even though HTTP header names are case-insensitive. Tests confirm this behavior for User-Agent: a canonical `User-Agent` entry in `defaultHeaders` overrides the value supplied through `userAgent`, while a lowercase `user-agent` entry can result in both values appearing after normalization. Do not configure the same header in multiple places or use `defaultHeaders` to override authentication or protocol headers.
userAgent
userAgent customizes the User-Agent header and is configured when constructing the client. The package supplies a default value when this option is omitted. Prefer this dedicated option when configuring the User-Agent rather than setting the same header in defaultHeaders.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, userAgent: 'OrcusApp/1.0',})acceptLanguage
acceptLanguage customizes the Accept-Language header and is configured when constructing the client. The package supplies a default value when this option is omitted.
Verified: configuring userAgent: "OrcusApp/1.0" and acceptLanguage: "en-US" results in those values being present in captured transport request headers.
Advanced options
sleep
sleep injects the sleep function used internally by the SDK. Configure it when constructing the client. This is useful for tests and custom execution environments that need control over timing behavior.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, sleep: async (ms) => { await new Promise((resolve) => setTimeout(resolve, ms)) },})yieldEvery
yieldEvery configures the work interval used by the proof-of-work solver. It defaults to 1024 and must be an integer greater than or equal to 1. An invalid value such as 0 produces a configuration error. Validation can occur after initial setup requests, so do not assume that invalid configuration always prevents every network request; the test suite confirms that the completion request is not sent for yieldEvery: 0.
const model = new DeepSeekWeb({ dsSessionId: process.env.DS_SESSION_ID!, authorization: process.env.DS_AUTHORIZATION!, yieldEvery: 1024,})Deriving clients with withConfig()
withConfig() creates a separate DeepSeekWeb instance with configuration overrides. It does not mutate the original client's conversation state. The derived client maintains its own conversation state rather than copying the original client's current conversation state.
const production = model.withConfig({ userAgent: 'OrcusApp/1.0', defaultHeaders: { 'X-Client-Name': 'production', },}) const response = await production.invoke('Hello!') console.log(response.content) // The original model remains a separate instance.Configuration overrides are shallowly merged. Nested objects are not automatically deep-merged: supplying a new defaultHeaders object replaces the previous defaultHeaders object instead of merging its individual entries.
const original = model.withConfig({ defaultHeaders: { 'X-Original': 'original-value', },}) const derived = original.withConfig({ defaultHeaders: { 'X-Derived': 'derived-value', },}) // The derived client's defaultHeaders contains X-Derived,// not the previous X-Original entry.Verified: withConfig() returns a different instance, leaves the original client's conversation state unchanged, and replaces the nested defaultHeaders object when an override is provided.
Verification
The configuration test suite passes all seven tests. Coverage includes the default searchEnabled value, per-call overrides, injected fetch and transport headers, invalid yieldEvery, client derivation with withConfig(), replacement of nested defaultHeaders, and the tested User-Agent casing behavior. These are controlled tests using mocked transport responses, not live upstream integration tests.
Use this page for client-wide configuration and transport behavior. For method-specific settings and limitations, consult the relevant feature pages rather than assuming every constructor option applies to every SDK method.