Skip to main content
Use this page when you need to tune SDK behavior beyond the default authenticated setup. Options apply to both the TypeScript and Python SDKs; where they differ, both are shown.

Client options

Python uses snake_case equivalents: apiKeyapi_key, baseURLbase_url, maxRetriesmax_retries.

Environment variables

The SDK uses CROSMOS_BASE_URL. The MCP server uses CROSMOS_API_BASE_URL.

Per-request options

Most SDK methods accept per-request overrides.
Use AbortController (TypeScript) or client.with_options() (Python) when you need to cancel a request or create a scoped client copy:

Retries and timeouts

The SDK retries transient failures twice by default with exponential backoff and jitter. Retries apply to connection errors, request timeouts, 408, 409, 429, and 5xx responses. Disable retries globally:
Tune retries for one request:

Handling errors

Raw responses

Every resource method returns a typed response. Use helper methods when you need the underlying HTTP response.
Use .asResponse() (TypeScript) or .with_streaming_response (Python) when you only need the raw response without parsing:

Pydantic responses

Python response objects are Pydantic models. Use .to_dict() and .to_json() to serialize them.

Custom HTTP client

Use fetchOptions (TypeScript) for runtime-specific transport settings:

Runtime support

TypeScript: Uses the runtime’s global fetch implementation by default. Supports modern browsers, Node.js 20 LTS or later, Bun 1.0 or later, Deno 1.28 or later, Cloudflare Workers, Vercel Edge Runtime, Jest with the node environment, and Nitro 2.6 or later. React Native is not supported. Python: Supports Python 3.8 and later. Uses httpx for HTTP transport and pydantic for response validation. The AsyncCrosmos client uses anyio and is compatible with asyncio and trio. An optional aiohttp backend is available for projects already using aiohttp: