> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mutagent.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Configure the Mutagent TypeScript SDK client.

The `Mutagent` client takes options controlling auth, the API endpoint, timeouts, and retries.
With no options it reads `MUTAGENT_API_KEY` from the environment and targets the hosted Platform.

```typescript theme={null}
import { Mutagent } from '@mutagent/sdk';

const client = new Mutagent({
  // Auth — defaults to the MUTAGENT_API_KEY env var.
  security: { apiKey: process.env.MUTAGENT_API_KEY },

  // Optional: override the endpoint, timeout, and retry behaviour.
  serverURL: 'https://api.mutagent.io',
  timeoutMs: 30_000,
  retryConfig: { strategy: 'backoff' },
});
```

| Option | Description |
| - | - |
| `security` | Credentials. Defaults to the `MUTAGENT_API_KEY` env var. |
| `serverURL` | API endpoint. Defaults to the hosted Platform. |
| `timeoutMs` | Per-request timeout in milliseconds. Default: no timeout. |
| `retryConfig` | Retry strategy for transient failures. |

## Which workspace a call acts in

A workspace API key acts in its own workspace. With an organization API key, name the workspace in
each call's request options, the last argument of every call:

```typescript theme={null}
const { configs } = await client.llmProviders.listProviderConfigs(
  {},
  { headers: { 'x-workspace-id': '<workspace-id>' } },
);
```

`client.workspaces.listWorkspaces()` returns the IDs as `workspaces[].id`. See
[API keys](https://docs.mutagent.io/quickstart/api-keys.md) for the two kinds of key.

## Errors

A call that fails throws. The error's message is the platform's own, for example
`Invalid, expired or revoked API key.` for a key that is not valid.

> [!TIP]
>
> You rarely need to set anything — `new Mutagent()` with `MUTAGENT_API_KEY` exported is enough for
> most scripts. Override `serverURL` only if you're pointed at a non-default endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.