Skip to main content
Fireworks hosts embedding and reranking models, which are useful for tasks like RAG and semantic search.

Generating embeddings

Embeddings models take text as input and output a vector of floating point numbers to use for tasks like similarity comparisons and search. Our embedding service is OpenAI compatible. Refer to OpenAI’s embeddings guide and OpenAI’s embeddings documentation for more information on using these models.

Choosing a model

Every option below uses the same endpoint, POST https://api.fireworks.ai/inference/v1/embeddings. What changes is the value you pass as model.
The Qwen3 Embedding family is hosted by Fireworks, with the 8B model available on serverless.Resizable models accept the dimensions parameter to return shorter vectors.Serverless usage of qwen3-embedding-8b is billed at $0.10 per million tokens. The 4B and 0.6B models require a dedicated deployment, and you can also deploy the 8B model that way for dedicated capacity.

Making a request

How you address the model depends on whether it runs on serverless or on a dedicated deployment.
Pass the model name directly.
Python
To generate variable-length embeddings, you can add the dimensions parameter to the request, for example, dimensions: 128. Only resizable models accept it: the Qwen3 embedding models do, and among the legacy models only nomic-ai/nomic-embed-text-v1.5 does. Any other model rejects the request with model: <id> is not resizable. The API usage for embedding models is identical for BERT-based and LLM-based embeddings. Simply use the /v1/embeddings endpoint with your chosen model.
Not every model returns unit-length vectors. Qwen3 embeddings are not normalized, so divide by the L2 norm before using a dot product as a cosine similarity, or use a similarity function that normalizes for you. Most of the legacy BERT models do return normalized vectors.

Other embedding options

You can retrieve embeddings from many LLMs in our model library. Here are some examples that work with the embeddings API:
  • fireworks/gpt-oss-20b
  • fireworks/gpt-oss-120b
  • fireworks/glm-5p2
A few caveats before you rely on this:
  • These vectors come from the model’s last-token hidden states, not a dedicated embedding head, so they are not trained for retrieval. Prefer a purpose-built embedding model when retrieval quality matters.
  • Raw hidden states are not unit vectors. Pass "normalize": true if you plan to compare them with cosine similarity.
  • Not every model in the library supports /v1/embeddings. Unsupported models return an embedding is not supported error.
normalize is not part of the OpenAI embeddings schema, so the Python SDK needs it in extra_body rather than as a top-level argument.
You can also retrieve embeddings from any models you bring yourself through custom model upload.
These models are not in the Model Library. You will not find them at fireworks.ai/models, but they still work on serverless if you pass the exact Hugging Face style id in the model field, for example nomic-ai/nomic-embed-text-v1.5 rather than accounts/fireworks/models/....
These models are serverless only; you cannot create a dedicated deployment for them.Resizable means the model accepts the dimensions parameter. Non-resizable models reject it with model: <id> is not resizable. Normalized means the returned vectors are unit length, so a dot product is already the cosine similarity; for the two that are not, normalize the output yourself before comparing.Retired. sentence-transformers/all-MiniLM-L6-v2 and sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 are no longer enabled on the shared serverless pool and return a not available error. Use BAAI/bge-small-en-v1.5 instead for a similarly small model.Quickstart
What to expect
  • Vector length and normalization vary by model, as shown in the table above.
  • Billing follows serverless embeddings pricing by parameter bucket. The five models up to 150M parameters bill at 0.008per1Minputtokens,andthethree335Mmodelsbillat0.008 per 1M input tokens, and the three 335M models bill at 0.016.
  • Serverless only, with no dedicated deployment option.

Reranking documents

Reranking models are used to rerank a list of documents based on a query. The /rerank endpoint provides a simple interface for this.
The /rerank endpoint does not yet support all models and parallelism options. For more flexibility, use the /embeddings endpoint with return_logits as shown in the next section.
Serverless usage of qwen3-reranker-8b is billed at $0.20 per million tokens. The 4B and 0.6B models require a dedicated deployment.

Making a request

Python

Using the /embeddings endpoint

You can also use the /embeddings endpoint with the return_logits parameter to rerank documents. This approach supports more models and parallelism options. The embedding model takes in token IDs for “yes” and “no” and outputs associated logits indicating how likely the document is relevant or not relevant to the query. You can obtain these token IDs using tokenizer.convert_tokens_to_ids() with the transformers library and the Qwen3 tokenizer.
Python
With normalize=True, the endpoint applies softmax to the selected logits, returning probabilities that sum to 1. The “yes” probability directly represents the relevance score.

Building a two-stage retrieval pipeline

Embeddings and reranking are usually combined: vector search recalls a broad candidate set quickly, then a reranker reorders those candidates for precision. This cookbook builds that pipeline end to end with Voyage models on Fireworks and MongoDB vector search.

Two-stage retrieval with Voyage embeddings and reranking

Embed a corpus with a Voyage embedding model, retrieve with MongoDB $vectorSearch, and rerank the candidates with Voyage ReRank 2.5.

Deploying embeddings and reranking models

While Qwen3 Embedding 8b and Qwen3 Reranker 8b are available on serverless, you also have the option to deploy them via on-demand deployments. Voyage models require a dedicated deployment.

Troubleshooting

Legacy BERT and sentence-transformers embedders are not listed in the Model Library, but they still serve on serverless. Pass the Hugging Face style id directly, for example BAAI/bge-small-en-v1.5. See BERT-based models (legacy) for the current list.
not found means the id does not resolve, which usually points to a typo or a deployment path for a deployment that does not exist in your account. not available means the id is real but is not enabled on the shared serverless pool, which is what retired legacy embedders return. In that case, switch to another model from the legacy list or to fireworks/qwen3-embedding-8b.
Dedicated deployments scale to zero when idle, so the first request after a quiet period can fail while the deployment cold-starts. Retry with backoff rather than treating it as a hard failure.