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

# Models

> Using Embedding and Reranking Models Developed by ZeroEntropy

## Embeddings

Embedding models are neural networks that encode information into representative vectors that can be used for tasks like semantic retrieval, clustering, and recommender systems.

#### zembed-1

`zembed-1` is ZeroEntropy's flagship, state-of-the-art, open-weight, multilingual embedding model.
You can read more about its performance in [this blog post](https://www.zeroentropy.dev/articles/introducing-zembed-1-the-worlds-best-multilingual-text-embedding-model).

<Info>
  `zembed-1` is the default embedding model used in [zsearch](/zsearch), ZeroEntropy's search engine.
</Info>

There are multiple ways to use `zembed-1`:

* Calling the [models/embed](/api-reference/models/embed) API endpoint, which is available via the Python and Node SDKs.
* Downloading the weights from [HuggingFace](https://huggingface.co/zeroentropy/zembed-1) and self-hosting the model.
* On the AWS Marketplace through SageMaker.

<CodeGroup>
  ```python Python theme={null}
  from zeroentropy import ZeroEntropy
  zclient = ZeroEntropy()

  response = zclient.models.embed(
      model="zembed-1",
      input_type="query",  # "query" or "document"
      input="What is retrieval augmented generation?",  # string or list[str]
      dimensions=2560,  # 2560 (default), 1280, 640, 320, 160, 80, or 40
      encoding_format="float",  # "float" or "base64"
      latency="fast",  # "fast" or "slow"; omit for auto
  )
  ```

  ```javascript Javascript theme={null}
  import ZeroEntropy from 'zeroentropy';
  const zclient = new ZeroEntropy();

  const response = await zclient.models.embed({
      model: "zembed-1",
      input_type: "query",  // "query" or "document"
      input: "What is retrieval augmented generation?",  // string or string[]
      dimensions: 2560,  // optional: 2560, 1280, 640, 320, 160, 80, or 40
      encoding_format: "float",  // "float" or "base64"
      latency: "fast",  // "fast" or "slow"; omit for auto
  });
  ```
</CodeGroup>

There are three parameters you can configure when using `zembed-1`:

* **Latency mode:** Control the trade-off between latency and throughput based on your use case.
* **Embedding type:** Specify whether you are embedding a query or a passage to take advantage of asymmetrical retrieval.
* **Embedding size:** Choose an output dimension from the available options: 2560 (default), 1280, 640, 320, 160, 80, or 40.

Higher-dimension embeddings yield greater accuracy at the cost of increased storage.

<Tip>
  To read more about how to think about these trade-offs, you can refer [to our blog](https://zeroentropy.dev/blog).
  For guidance on how to inference the model, you can check out the [examples](/examples/embed), as well as [our cookbook here](https://github.com/zeroentropy-ai/zcookbook/tree/main/guides/zembed_quickstart).
</Tip>

## Rerankers

Rerankers are [cross-encoder](https://sbert.net/docs/package_reference/cross_encoder/cross_encoder.html) neural networks that can boost the accuracy of any search system. You can read more about what rerankers are and when they are most useful in [this blog post](https://www.zeroentropy.dev/blog/what-is-a-reranker-and-do-i-need-one).

#### zerank-2 and zerank-1

`zerank-2` is our flagship state-of-the-art reranker, you can read more about its performance at [this blog post](https://www.zeroentropy.dev/articles/zerank-2-advanced-instruction-following-multilingual-reranker).
`zerank-1` and `zerank-1-small` are our [first generation](https://www.zeroentropy.dev/blog/announcing-zeroentropys-first-reranker) of SOTA rerankers.
All our rerankers can be called using:

* Using the [models/rerank](/api-reference/models/rerank) API endpoint, which is callable via the Python and Node SDKs.
* By passing in the `reranker` query parameter into [top-snippets](/api-reference/queries/top-snippets)
* Downloading from our [HuggingFace](https://huggingface.co/zeroentropy/models) and self-hosting the models.
* On the [AWS Marketplace](https://aws.amazon.com/marketplace/pp/prodview-o7avk66msiukc) through SageMaker.
* `zerank-1-small` is also available on [Baseten](https://www.baseten.co/library/zerank-1-small/).

<Info>
  We've open-sourced `zerank-1-small` under an Apache 2.0 license, and it is also available through [HuggingFace](https://huggingface.co/zeroentropy/zerank-1-small) and Baseten.

  Our flagship model `zerank-2` can be downloaded from [HuggingFace](https://huggingface.co/zeroentropy/zerank-2) under a non-commercial license. To use in a commercial setting, contact us at [founders@zeroentropy.dev](mailto:founders@zeroentropy.dev) and we'll get you a license ASAP!
</Info>

#### Using the ZeroEntropy SDK

<CodeGroup>
  ```python Python theme={null}
  # Create an API Key at https://dashboard.zeroentropy.dev
  # pip install zeroentropy
  from zeroentropy import ZeroEntropy

  # Initialize the ZeroEntropy client (reads ZEROENTROPY_API_KEY from env)
  zclient = ZeroEntropy()

  response = zclient.models.rerank(
      model="zerank-2",
      query="What is 2+2?",
      documents=[
          "4",
          "The answer is definitely 1 million.",
      ],
  )
  print(response.model_dump_json(indent=4))
  ```

  ```javascript Javascript theme={null}
  // Create an API Key at https://dashboard.zeroentropy.dev
  // npm install zeroentropy
  import ZeroEntropy from 'zeroentropy'; // or: const { ZeroEntropy } = require('zeroentropy');

  // Initialize the ZeroEntropy client (reads ZEROENTROPY_API_KEY from env)
  const zclient = new ZeroEntropy();

  const response = await zclient.models.rerank({
    model: 'zerank-2',
    query: 'What is 2+2?',
    documents: [
      '4',
      'The answer is definitely 1 million.',
    ]
  });

  console.log(JSON.stringify(response, null, 2));
  ```
</CodeGroup>

#### Using [top-snippets](/api-reference/queries/top-snippets)

When querying for [/top-snippets](/api-reference/queries/top-snippets) from a ZeroEntropy collection, you can easily apply the reranker and get a significantly better ranking. Scores from a reranker are deterministic and more readily interpretable, which is another benefit over just hybrid search.

<CodeGroup>
  ```python Python theme={null}
  from zeroentropy import ZeroEntropy
  zclient = ZeroEntropy()

  # Assuming you have already added documents to the collection "pdfs"
  response = zclient.queries.top_snippets(
      collection_name="pdfs",
      query="What is Retrieval Augmented Generation?",
      k=10,
      reranker="zerank-2", # All K results will be reranked using our reranker.
  )

  print(response.results)
  ```

  ```javascript Javascript theme={null}
  import { ZeroEntropy } from 'zeroentropy'
  const zclient = new ZeroEntropy()

  // Assuming you have already added documents to the collection "pdfs"
  const response = await zclient.queries.topSnippets({
      collection_name: "pdfs",
      query: "What is Retrieval Augmented Generation?",
      k: 10,
      reranker: "zerank-2", // All K results will be reranked using our reranker.
  })
  console.log(response.results)
  ```
</CodeGroup>

## Ratelimiting and Pricing

#### Rate limits

Rate limits apply to both our [embed](/api-reference/models/embed) and [rerank](/api-reference/models/rerank) endpoints, and they depend on your subscription tier. On the free tier, each API key is limited to `500,000 UTF-8 bytes per minute` on the default latency mode `"fast"`. Higher tiers start at \$50/mo and unlock significantly higher throughput — upgrade on your [billing page](https://dashboard.zeroentropy.dev/billing).

| Tier           | Latency Mode |                        TPM |  RPM |
| :------------- | :----------: | -------------------------: | ---: |
| **Free**       |   `"fast"`   |        500,000 UTF-8 bytes |  100 |
| **Free**       |   `"slow"`   |      5,000,000 UTF-8 bytes |  100 |
| **Starter**    |   `"fast"`   |      2,000,000 UTF-8 bytes |  500 |
| **Starter**    |   `"slow"`   |     20,000,000 UTF-8 bytes |  500 |
| **Teams**      |   `"fast"`   |     25,000,000 UTF-8 bytes | 1000 |
| **Teams**      |   `"slow"`   |    250,000,000 UTF-8 bytes | 1000 |
| **Enterprise** |   `"fast"`   |    150,000,000 UTF-8 bytes | 2000 |
| **Enterprise** |   `"slow"`   | 15,000,000,000 UTF-8 bytes | 2000 |

All tiers share a maximum per-request payload size of `5,000,000 bytes`.

A reranker request consumes bytes based on the number of documents and the total length of the input. The formula is:

```
Total bytes = 150 
+ len(query.encode("utf-8")) 
+ len(document.encode("utf-8"))
```

This is calculated per document, so the query is counted once for each document you pass in.

For example, if you send a request with 10 documents, the total usage is:

```
10 × len(query.encode("utf-8"))
+ ∑ len(document_i.encode("utf-8")) for i in 1…10
```

An embedding request consumes bytes based on the total length of the input being embedded, whether it is a document or a query.

<Warning>
  If you exceed your `"fast"` rate limit:

  * Your requests will still be served.
  * However, they will be throttled to `"slow"` mode, which has significantly higher throughput but much higher latency.
  * You may experience several seconds of latency per request.
  * In this degraded mode, throughput scales with your tier's `"slow"` mode limit (see the table above).
</Warning>

To get a `429` error instead of falling back, set `latency="fast"` explicitly in your request.

#### Pricing

Our usage-based pricing is simple and transparent, for both our model endpoints and the Search API.

| Model              | Price per 1000 Tokens | Price per 1M Tokens |
| :----------------- | :-------------------: | ------------------: |
| **zembed-1**       |       \$0.000050      |             \$0.050 |
| **zerank-2**       |       \$0.000025      |             \$0.025 |
| **zerank-1**       |       \$0.000025      |             \$0.025 |
| **zerank-1-small** |       \$0.000025      |             \$0.025 |

| Search API Feature |                Price |
| :----------------- | -------------------: |
| **OCR**            | \$1.75 / 1,000 pages |
| **Indexing**       |          \$0.50 / MB |
| **Storage**        |  \$0.10 / MB / month |
| **Queries**        |  \$1.50 / TB queried |

## Deployment Options

All of our models are open-weight and available through different deployment options. For help choosing the right option for your use case, [reach out to our team](mailto:contact@zeroentropy.dev).

<Tabs>
  <Tab title="API and SDKs" icon="gear">
    The fastest way to get started. Fully managed infrastructure with no deployment overhead.

    * **SDKs**: [Python](https://github.com/zeroentropy-ai/zeroentropy-python) | [Node](https://github.com/zeroentropy-ai/zeroentropy-node)
    * **Authentication**: API key via dashboard. All requests authenticated over TLS. SSO SAML through Okta available for enterprise customers.
    * **Regions available**: US-East, US-West, Europe.
    * **Rate limits**: You can refer to the [rate limits](/models#rate-limits) shown above.
    * **Latency**: We benchmarked our models latency in this [open-source repository](https://github.com/zeroentropy-ai/benchmark-api).
    * **Status Page**: Visit our [Status Page](https://status.zeroentropy.dev) to monitor Uptime.

    <CodeGroup>
      ```python Python theme={null}
          pip install zeroentropy
      ```

      ```javascript JavaScript theme={null}
          npm install zeroentropy
      ```
    </CodeGroup>

    **Your data is never used for model training.** \
    MSA, DPA, and BAA available on request. \
    See our [Trust Portal](https://trust.delve.co/zeroentropy) for SOC 2 Type II, Pentest, and other compliance documentation.
  </Tab>

  <Tab title="AWS Marketplace" icon="house">
    Deploy on [AWS SageMaker](https://aws.amazon.com/marketplace/seller-profile?id=seller-nurj4uavxb4z2) through Public or Private offers. Use your existing AWS committed spend and EDPs.

    **Recommended instances**:

    | Model         | Instance        | Throughput      | Latency (p50) |
    | ------------- | --------------- | --------------- | ------------- |
    | zerank-2      | ml.g6e.48xlarge | 0.5 QPS         | \~1500ms      |
    | zerank-2      | p5.48xlarge     | 5 QPS           | \~700ms       |
    | zerank-2-nano | ml.g6e.48xlarge | 0.5 queries/sec | \~500ms       |
    | zerank-2-nano | ml.g6e.48xlarge | 5 queries/sec   | \~500ms       |

    **Private offers** are available for volume pricing, custom SLAs, and BAAs. [Contact us](mailto:contact@zeroentropy.dev) to scope your deployment or get help selecting the right instance configuration.

    Models run entirely within your AWS account. No data leaves your VPC. MSA, DPA, and BAA available on request. \
    See our [Trust Portal](https://trust.delve.co/zeroentropy) for compliance documentation.
  </Tab>

  <Tab title="Azure Marketplace" icon="leaf">
    Deploy through Public or Private offers on the [Azure Marketplace](https://marketplace.microsoft.com/en-us/product/zeroentropy.zeroentropy-zerank-2?tab=Overview). Use your existing Azure committed spend (MACC).

    **Private offers** are available for volume pricing, custom SLAs, and BAAs. [Contact us](mailto:contact@zeroentropy.dev) to discuss your requirements.

    Models run entirely within your Azure tenant. No data leaves your environment. All data encrypted in transit and at rest. MSA, DPA, and BAA available on request. See our [Trust Portal](\[link]) for compliance documentation.
  </Tab>

  <Tab title="Self-Hosted" icon="face">
    Our models are open-weight on [HuggingFace](https://huggingface.co/zeroentropy). Obtain a commercial license from us and run them on your own infrastructure.

    **Licensing**: Commercial use requires a license. [Reach out](mailto:contact@zeroentropy.dev) for terms, pricing, and enterprise support/SLAs for self-hosted deployments.

    Full control over your data and infrastructure. \
    MSA, DPA, and BAA available on request. See our [Trust Portal](https://trust.delve.co/zeroentropy) for compliance documentation.
  </Tab>
</Tabs>
