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

# Configuration

> Client options, per-request options, logging, and other advanced settings.

## Client options

| Option | Environment variable | Default |
| - | - | - |
| `apiKey` | `FINESSE_API_KEY` | required, unless `accessToken` |
| `accessToken` | | none (a short-lived `fin_tok_` token) |
| `timeout` | | 120 000 ms |
| `maxRetries` | | 2 |
| `defaultHeaders` | | none |
| `fetch` | | the global `fetch` |
| `dangerouslyAllowBrowser` | | `false` |
| `logLevel` | `FINESSE_LOG` | `"off"` |
| `logger` | | `console` |

## Per-request options

Every request method accepts options for that call only, as its last argument:
`{ signal, timeout, maxRetries, headers }`.

<CodeGroup>
  ```ts TypeScript theme={null}
  await client.speech.create(
    { voice_id, text: "Hello!" },
    { timeout: 30_000, maxRetries: 0, headers: { "X-Request-Id": "abc-123" } },
  );
  ```
</CodeGroup>

## Raw responses

`withRawResponse` has the same methods and returns the HTTP response along
with the result:

<CodeGroup>
  ```ts TypeScript theme={null}
  const { data: audio, status, requestId, headers } = await client.withRawResponse.speech.create({
    voice_id,
    text: "Hello!",
  });
  console.log(status, requestId, headers.get("x-sample-rate"));
  ```
</CodeGroup>

## Logging

Set `FINESSE_LOG=debug` to log every request (method, URL, status, timing, request ID), or
`FINESSE_LOG=info` to log only retries. The SDK never logs your API key, request bodies or audio.
You can also set `logLevel` on the client, and pass `logger` to send the lines somewhere other
than `console`.

## Copy a client with other defaults

<CodeGroup>
  ```ts TypeScript theme={null}
  const quick = client.withOptions({ timeout: 10_000, maxRetries: 0 });
  await quick.voices.get(voiceId);
  ```
</CodeGroup>

The copy shares the original client's connections.

## Custom HTTP client

<CodeGroup>
  ```ts TypeScript theme={null}
  const client = new Finesse({ fetch: myFetch });
  ```
</CodeGroup>

## Identify your integration

Requests identify the SDK with an `X-Finesse-Client` header. If you build an integration on top of
the SDK, name it so it shows up in your usage analytics:

<CodeGroup>
  ```ts TypeScript theme={null}
  const client = new Finesse({ defaultHeaders: { "X-Finesse-Client": "my-app/1.0.0" } });
  ```
</CodeGroup>


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