> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/DecartAI/ai-sdk-provider/llms.txt
> Use this file to discover all available pages before exploring further.

# createDecart()

> Factory function to create a configured Decart provider instance

## Function Signature

```typescript theme={null}
function createDecart(options?: DecartProviderSettings): DecartProvider
```

Creates and configures a Decart provider instance with custom settings. Use this when you need to configure API keys, base URLs, or other provider-level settings.

## Parameters

<ParamField path="options" type="DecartProviderSettings" default="{}">
  Optional configuration object for the provider

  <Expandable title="DecartProviderSettings properties">
    <ParamField path="apiKey" type="string" optional>
      API key for authentication. If not provided, will load from `DECART_API_KEY` environment variable.
    </ParamField>

    <ParamField path="baseURL" type="string" optional>
      Base URL for API requests. Defaults to `https://api.decart.ai`.
    </ParamField>

    <ParamField path="headers" type="Record<string, string>" optional>
      Custom headers to include with every request.
    </ParamField>

    <ParamField path="fetch" type="FetchFunction" optional>
      Custom fetch implementation for making HTTP requests.
    </ParamField>
  </Expandable>
</ParamField>

## Returns

<ResponseField name="DecartProvider" type="DecartProvider">
  A configured provider instance with methods to create image and video models.

  See [DecartProvider](/api/decart-provider) for full interface details.
</ResponseField>

## Examples

### Default Configuration

```typescript theme={null}
import { createDecart } from '@decartai/ai-sdk-provider';

const decart = createDecart();
// Uses DECART_API_KEY from environment
```

### Custom API Key

```typescript theme={null}
import { createDecart } from '@decartai/ai-sdk-provider';

const decart = createDecart({
  apiKey: 'your-api-key-here'
});
```

### Custom Base URL

```typescript theme={null}
import { createDecart } from '@decartai/ai-sdk-provider';

const decart = createDecart({
  baseURL: 'https://custom-api.example.com',
  apiKey: 'your-api-key-here'
});
```

### Custom Headers

```typescript theme={null}
import { createDecart } from '@decartai/ai-sdk-provider';

const decart = createDecart({
  headers: {
    'X-Custom-Header': 'value'
  }
});
```

## Default Instance

A default pre-configured instance is also exported:

```typescript theme={null}
import { decart } from '@decartai/ai-sdk-provider';

// Equivalent to createDecart()
const model = decart.image('lucy-pro-t2i');
```

## VERSION Export

The package version is also exported for runtime version checking:

```typescript theme={null}
import { VERSION } from '@decartai/ai-sdk-provider';

console.log(`Using Decart provider version: ${VERSION}`);
```

<ParamField path="VERSION" type="string">
  The current version of the `@decartai/ai-sdk-provider` package.
</ParamField>
