
# Mixedbread Provider

[patelvivekdev/mixedbread-ai-provider](https://github.com/patelvivekdev/mixedbread-ai-provider) is a community provider that uses [Mixedbread](https://www.mixedbread.ai/) to provide Embedding support for the AI SDK.

## Setup

The Mixedbread provider is available in the `mixedbread-ai-provider` module. You can install it with

<Tabs items={['pnpm', 'npm', 'yarn']}>
  <Tab>
    <Snippet text="pnpm add mixedbread-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="npm install mixedbread-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="yarn add mixedbread-ai-provider" dark />
  </Tab>
</Tabs>

## Provider Instance

You can import the default provider instance `mixedbread ` from `mixedbread-ai-provider`:

```ts
import { mixedbread } from 'mixedbread-ai-provider';
```

If you need a customized setup, you can import `createMixedbread` from `mixedbread-ai-provider` and create a provider instance with your settings:

```ts
import { createMixedbread } from 'mixedbread-ai-provider';

const mixedbread = createMixedbread({
  baseURL: 'https://api.mixedbread.ai/v1',
  apiKey: process.env.MIXEDBREAD_API_KEY,
});
```

You can use the following optional settings to customize the Mixedbread provider instance:

- **baseURL** _string_

  The base URL of the Mixedbread API

- **headers** _Record&lt;string,string&gt;_

  Custom headers to include in the requests.

## Embedding Models

You can create models that call the [Mixedbread embeddings API](https://www.mixedbread.ai/api-reference/endpoints/embeddings)
using the `.embedding()` factory method.

```ts
import { mixedbread } from 'mixedbread-ai-provider';

const embeddingModel = mixedbread.textEmbeddingModel(
  'mixedbread-ai/mxbai-embed-large-v1',
);
```

### Model Capabilities

| Model                             | Default Dimensions | Context Length | Custom Dimensions   |
| --------------------------------- | ------------------ | -------------- | ------------------- |
| `mxbai-embed-large-v1`            | 1024               | 512            | <Check size={18} /> |
| `deepset-mxbai-embed-de-large-v1` | 1024               | 512            | <Check size={18} /> |

<Note>
  The table above lists popular models. Please see the [Mixedbread
  docs](https://www.mixedbread.ai/docs/embeddings/models) for a full list of
  available models.
</Note>

### Add settings to the model

The settings object should contain the settings you want to add to the model.

```ts
import { mixedbread } from 'mixedbread-ai-provider';

const embeddingModel = mixedbread.textEmbeddingModel(
  'mixedbread-ai/mxbai-embed-large-v1',
  {
    prompt: 'Generate embeddings for text', // Max 256 characters
    dimensions: 512, // Max 1024 for embed-large-v1
  },
);
```


## Navigation

- [Writing a Custom Provider](/v4/providers/community-providers/custom-providers)
- [Qwen](/v4/providers/community-providers/qwen)
- [Ollama](/v4/providers/community-providers/ollama)
- [Chrome AI](/v4/providers/community-providers/chrome-ai)
- [FriendliAI](/v4/providers/community-providers/friendliai)
- [Portkey](/v4/providers/community-providers/portkey)
- [Cloudflare Workers AI](/v4/providers/community-providers/cloudflare-workers-ai)
- [Cloudflare AI Gateway](/v4/providers/community-providers/cloudflare-ai-gateway)
- [OpenRouter](/v4/providers/community-providers/openrouter)
- [Azure AI](/v4/providers/community-providers/azure-ai)
- [Crosshatch](/v4/providers/community-providers/crosshatch)
- [Requesty](/v4/providers/community-providers/requesty)
- [Mixedbread](/v4/providers/community-providers/mixedbread)
- [Voyage AI](/v4/providers/community-providers/voyage-ai)
- [Hyperbolic](/v4/providers/community-providers/hyperbolic)
- [Mem0](/v4/providers/community-providers/mem0)
- [Letta](/v4/providers/community-providers/letta)
- [LLamaCpp](/v4/providers/community-providers/llama-cpp)
- [Anthropic Vertex](/v4/providers/community-providers/anthropic-vertex-ai)
- [Spark](/v4/providers/community-providers/spark)
- [Inflection AI](/v4/providers/community-providers/inflection-ai)
- [LangDB](/v4/providers/community-providers/langdb)
- [Zhipu AI](/v4/providers/community-providers/zhipu)
- [SambaNova](/v4/providers/community-providers/sambanova)
- [Dify](/v4/providers/community-providers/dify)
- [Sarvam](/v4/providers/community-providers/sarvam)


[Full Sitemap](/sitemap.md)
