---
description: BAAI general embedding (Base) model that transforms any given text into a 768-dimensional vector
title: bge-base-en-v1.5
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt  
> Use this file to discover all available pages before exploring further.

![BAAI logo](https://developers.cloudflare.com/_astro/baai.BooZR_xF.svg)

# bge-base-en-v1.5

Text Embeddings • BAAI

Copy as Markdown| [View as Markdown](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/index.md)| [Agent setup](https://developers.cloudflare.com/agent-setup/)

Model ID

`@cf/baai/bge-base-en-v1.5` Copy

- Cloudflare-hosted
- Batch
- Zero data retention

BAAI general embedding (Base) model that transforms any given text into a 768-dimensional vector

| Model Info | |
| --- | --- |
| Context Window [ ↗](https://developers.cloudflare.com/workers-ai/platform/glossary/) | 153,600 tokens |
| More information | [link ↗](https://huggingface.co/BAAI/bge-base-en-v1.5) |
| Maximum Input Tokens | 512 |
| Output Dimensions | 768 |
| Zero data retention | Yes |
| Batch | Yes |
| Unit Pricing | $0.0666 per M input tokens |

## Usage

```ts
export interface Env {
  AI: Ai;
}

export default {
  async fetch(request, env): Promise<Response> {

    // Can be a string or array of strings]
    const stories = [
      "This is a story about an orange cloud",
      "This is a story about a llama",
      "This is a story about a hugging emoji",
    ];

    const embeddings = await env.AI.run(
      "@cf/baai/bge-base-en-v1.5",
      {
        text: stories,
      }
    );

    return Response.json(embeddings);
  },
} satisfies ExportedHandler<Env>;
```

```py
import os
import requests


ACCOUNT_ID = "your-account-id"
AUTH_TOKEN = os.environ.get("CLOUDFLARE_AUTH_TOKEN")

stories = [
  'This is a story about an orange cloud',
  'This is a story about a llama',
  'This is a story about a hugging emoji'
]

response = requests.post(
  f"https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/@cf/baai/bge-base-en-v1.5",
  headers={"Authorization": f"Bearer {AUTH_TOKEN}"},
  json={"text": stories}
)

print(response.json())
```

```sh
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/@cf/baai/bge-base-en-v1.5  \
  -X POST  \
  -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"  \
  -d '{ "text": ["This is a story about an orange cloud", "This is a story about a llama", "This is a story about a hugging emoji"] }'
```

OpenAI compatible endpoints

Workers AI also supports OpenAI compatible API endpoints for `/v1/chat/completions` and `/v1/embeddings`. For more details, refer to [Configurations](https://developers.cloudflare.com/workers-ai/configuration/open-ai-compatibility/).

## Parameters

<details>

<summary>Synchronous — Send a request and receive a complete response</summary>



▶text

<code>one of</code>required

pooling

<code>string</code>default: meanenum: mean, clsThe pooling method used in the embedding process. `cls` pooling will generate more accurate embeddings on larger inputs - however, embeddings created with cls pooling are not compatible with embeddings generated with mean pooling. The default pooling method is `mean` in order for this to not be a breaking change, but we highly suggest using the new `cls` pooling for better accuracy.

▶shape\[]

<code>array</code>

▶data\[]

<code>array</code>Embeddings of the requested text values

pooling

<code>string</code>enum: mean, clsThe pooling method used in the embedding process.

</details>

<details>

<summary>Batch — Send multiple requests in a single API call</summary>



▶requests\[]

<code>array</code>requiredBatch of the embeddings requests to run using async-queue

▶shape\[]

<code>array</code>

▶data\[]

<code>array</code>Embeddings of the requested text values

pooling

<code>string</code>enum: mean, clsThe pooling method used in the embedding process.

</details>

## API Schemas (Raw)

SynchronousInput [Open](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/sync-input.json) [Download](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/sync-input.json)

SynchronousOutput [Open](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/sync-output.json) [Download](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/sync-output.json)

BatchInput [Open](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/batch-input.json) [Download](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/batch-input.json)

BatchOutput [Open](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/batch-output.json) [Download](https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/batch-output.json)

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/#page","headline":"bge-base-en-v1.5","description":"BAAI general embedding (Base) model that transforms any given text into a 768-dimensional vector","url":"https://developers.cloudflare.com/workers-ai/models/bge-base-en-v1.5/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
