openapi: 3.0.2
info:
title: Voyage API
description: 'The VoyageAI REST API. Please see https://docs.voyageai.com/reference
for more details.
'
version: '1.1'
contact:
name: VoyageAI Support
url: https://docs.voyageai.com/docs/faq
email: contact@voyageai.com
license:
name: MIT
url: https://github.com/voyage-ai/openapi/blob/main/LICENSE
servers:
- url: https://api.voyageai.com/v1
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: 'Authorization: Bearer'
x-default: $VOYAGE_API_KEY
security:
- ApiKeyAuth: []
tags:
- name: Endpoints
paths:
/embeddings:
post:
tags:
- Endpoints
summary: Text embedding models
description: Voyage text embedding endpoint receives as input a string (or a
list of strings) and other arguments such as the preferred model name, and
returns a response containing a list of embeddings.
operationId: embeddings-api
requestBody:
content:
application/json:
schema:
type: object
required:
- input
- model
properties:
input:
type: object
description: 'A single text string, or a list of texts as a list
of strings, such as `["I like cats", "I also like dogs"]`. Currently,
we have two constraints on the list:
- The maximum length
of the list is 128.
- The total number of tokens in
the list is at most 1M for `voyage-3-lite`; 320K for `voyage-3`
and `voyage-2`; and 120K for `voyage-3-large`, `voyage-code-3`,
`voyage-large-2-instruct`, `voyage-finance-2`, `voyage-multilingual-2`,
`voyage-law-2`, and `voyage-large-2`.
'
oneOf:
- type: string
- type: array
items:
type: string
model:
type: string
description: 'Name of the model. Recommended options: `voyage-3-large`,
`voyage-3`, `voyage-3-lite`, `voyage-code-3`, `voyage-finance-2`,
`voyage-law-2`.
'
input_type:
type: string
description: "Type of the input text. Defaults to `null`. Other\
\ options: `query`, `document`. - When `input_type` is\
\ `null`, the embedding model directly converts the inputs (`texts`)\
\ into numerical vectors. For retrieval/search purposes, where\
\ a \"query\" is used to search for relevant information among\
\ a collection of data referred to as \"documents,\" we recommend\
\ specifying whether your inputs (`texts`) are intended as queries\
\ or documents by setting `input_type` to `query` or `document`,\
\ respectively. In these cases, Voyage automatically prepends\
\ a prompt to your `inputs` before vectorizing them, creating\
\ vectors more tailored for retrieval/search tasks. Embeddings\
\ generated with and without the `input_type` argument are compatible.\
\
- For transparency, the following prompts are prepended\
\ to your input.
\n \n - For\_
query,\
\ the prompt is \"Represent the query for retrieving supporting\
\ documents:\_\". \n - For\_
document,\
\ the prompt is \"Represent the document for retrieval:\_\"\
. \n
\n \n"
enum:
- null
- query
- document
nullable: true
default: null
truncation:
type: boolean
description: 'Whether to truncate the input texts to fit within
the context length. Defaults to `true`. - If `true`,
an over-length input texts will be truncated to fit within the
context length, before vectorized by the embedding model.
-
If `false`, an error will be raised if any given text exceeds
the context length.
'
default: true
output_dimension:
type: integer
description: 'The number of dimensions for resulting output embeddings.
Defaults to `null`. - Most models only support a single
default dimension, used when `output_dimension` is set to `null`
(see output embedding dimensions here).
- `voyage-3-large` and `voyage-code-3`
support the following `output_dimension` values: 2048, 1024 (default),
512, and 256.
'
nullable: true
default: null
output_dtype:
type: string
description: 'The data type for the embeddings to be returned. Defaults
to `float`. Other options: `int8`, `uint8`, `binary`, `ubinary`.
`float` is supported for all models. `int8`, `uint8`, `binary`,
and `ubinary` are supported by `voyage-3-large` and `voyage-code-3`.
Please see our guide for more details about output data types.
- `float`: Each returned embedding is a list of 32-bit
(4-byte) single-precision floating-point numbers. This
is the default and provides the highest precision / retrieval
accuracy.
- `int8` and `uint8`: Each returned embedding
is a list of 8-bit (1-byte) integers ranging from -128 to 127
and 0 to 255, respectively.
- `binary` and `ubinary`:
Each returned embedding is a list of 8-bit integers that represent
bit-packed, quantized single-bit embedding values: `int8` for
`binary` and `uint8` for `ubinary`. The length of the returned
list of integers is 1/8 of `output_dimension` (which is the actual
dimension of the embedding). The `binary` type uses the offset
binary method. Please refer to our guide for details on offset binary and binary embeddings.
'
enum:
- float
- int8
- uint8
- binary
- ubinary
default: float
encoding_format:
type: string
description: "Format in which the embeddings are encoded. Defaults\
\ to\_`null`. Other options: `base64`. - If\_`null`, each\
\ embedding is an array of float numbers when `output_dtype` is\
\ set to `float` and as an array of integers for all other values\
\ of `output_dtype` (`int8`, `uint8`, `binary`, and `ubinary`).\
\
- If\_`base64`, the embeddings are represented as a Base64-encoded NumPy array of:
\n \n - Floating-point\
\ numbers (numpy.float32) for
output_dtype\
\ set to float. \n - Signed integers (numpy.int8) for
output_dtype\
\ set to int8 or binary. \n \
\ - Unsigned integers (numpy.uint8) for
output_dtype\
\ set to uint8 or ubinary. \n \
\
\n
\n"
enum:
- null
- base64
nullable: true
default: null
responses:
'200':
description: Success
content:
application/json:
schema:
properties:
object:
type: string
description: The object type, which is always "list".
data:
type: array
description: An array of embedding objects.
items:
type: object
properties:
object:
type: string
description: The object type, which is always "embedding".
embedding:
type: array
description: 'Each embedding is a vector represented as
an array of float numbers when `output_dtype` is set to
`float` and as an array of integers for all other values
of `output_dtype` (`int8`, `uint8`, `binary`, and `ubinary`).
The length of this vector varies depending on the specific
model, `output_dimension`, and `output_dtype`.
'
items:
type: number
index:
type: integer
description: 'An integer representing the index of the embedding
within the list of embeddings.
'
model:
type: string
description: Name of the model.
usage:
type: object
properties:
total_tokens:
type: integer
description: The total number of tokens used for computing
the embeddings.
4XX:
description: 'Client error This indicates an issue with the request
format or frequency. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'
content:
application/json:
schema:
properties:
detail:
type: string
description: The error message.
5XX:
description: 'Server Error This indicates our servers are experiencing
high traffic or having an unexpected issue. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'
/multimodalembeddings:
post:
tags:
- Endpoints
summary: Multimodal embedding models
description: The Voyage multimodal embedding endpoint returns vector representations
for a given list of multimodal inputs consisting of text, images, or an interleaving
of both modalities.
operationId: multimodal-embeddings-api
requestBody:
content:
application/json:
schema:
type: object
required:
- inputs
- model
properties:
inputs:
type: array
description: "A list of multimodal inputs to be vectorized.
\
\
A single input in the list is a dictionary containing a\
\ single key\_`\"content\"`, whose value represents a sequence\
\ of text and images. \n - The value of\_
\"content\"\
\_is a list of dictionaries, each representing a single\
\ piece of text or image. The dictionaries have four possible\
\ keys:\n \n - \
\ type: Specifies the type of the piece of the content.\
\ Allowed values are
text, image_url,\
\ or image_base64. \n - text:\
\ Only present when
type is text. The\
\ value should be a text string. \n - image_base64:\
\ Only present when
type is image_base64.\
\ The value should be a Base64-encoded image in the data URL format data:[<mediatype>];base64,<data>.\
\ Currently supported mediatypes are: image/png,\
\ image/jpeg, image/webp, and image/gif. \n\
\ - image_url: Only present when
type\
\ is image_url. The value should be a URL linking\
\ to the image. We support PNG, JPEG, WEBP, and GIF images. \n\
\
\n \n - Note: Only one of the keys,\
\
image_base64 or image_url, should\
\ be present in each dictionary for image data. Consistency is\
\ required within a request, meaning each request should use either\
\ image_base64 or image_url exclusively\
\ for images, not both.
\n
\n Example\
\ payload where inputs\_contains an image as a URL\
\
\n
\n The inputs list contains\
\ a single input, which consists of a piece of text and an image\
\ (which is provided via a URL).\n \n {\n\
\ \"inputs\": [\n { \n \"content\"\
: [\n { \n \"type\": \"text\",\n\
\ \"text\": \"This is a banana.\"\n \
\ }, \n { \n \"type\": \"image_url\"\
,\n \"image_url\": \"https://raw.githubusercontent.com/voyage-ai/voyage-multimodal-3/refs/heads/main/images/banana.jpg\"\
\n } \n ] \n } \n \
\ ], \n \"model\": \"voyage-multimodal-3\"\n }\n\
\
\n \n Example\
\ payload where inputs\_contains a Base64 image
\n\
\
\n Below is an equivalent example to the one above\
\ where the image content is a Base64 image instead of a URL.\
\ (Base64 images can be lengthy, so the example only shows a shortened\
\ version.)\n \n {\n \"inputs\"\
: [\n { \n \"content\": [\n \
\ { \n \"type\": \"text\",\n \
\ \"text\": \"This is a banana.\"\n }, \n \
\ { \n \"type\": \"image_base64\",\n \
\ \"image_base64\": \"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA...\"\
\n } \n ] \n } \n \
\ ], \n \"model\": \"voyage-multimodal-3\"\n }\n\
\
\n \n \n
\nThe following constraints apply to the inputs\
\ list: \n - The list must not contain more than\
\ 1000 inputs.
\n - Each image must not contain more\
\ than 16 million pixels or be larger than 20 MB in size.
\n\
\ - With every 560 pixels of an image being counted as a\
\ token, each input in the list must not exceed 32,000 tokens,\
\ and the total number of tokens across all inputs must not exceed\
\ 320,000.
\n
\n"
model:
type: string
description: 'Name of the model. Currently, the only supported model
is `voyage-multimodal-3`.
'
input_type:
type: string
description: "Type of the input. Defaults to `null`. Other options:\
\ `query`, `document`. - When `input_type` is `null`,\
\ the embedding model directly converts the `inputs` into numerical\
\ vectors. For retrieval/search purposes, where a \"query\", which\
\ can be text or image in this case, is used to search for relevant\
\ information among a collection of data referred to as \"documents,\"\
\ we recommend specifying whether your `inputs` are intended as\
\ queries or documents by setting `input_type` to `query` or `document`,\
\ respectively. In these cases, Voyage automatically prepends\
\ a prompt to your `inputs` before vectorizing them, creating\
\ vectors more tailored for retrieval/search tasks. Since inputs\
\ can be multimodal, \"queries\" and \"documents\" can be text,\
\ images, or an interleaving of both modalities. Embeddings generated\
\ with and without the `input_type` argument are compatible.
\
\ - For transparency, the following prompts are prepended to\
\ your input.
\n \n - For\_
query,\
\ the prompt is \"Represent the query for retrieving supporting\
\ documents:\_\". \n - For\_
document,\
\ the prompt is \"Represent the document for retrieval:\_\"\
. \n
\n\n"
enum:
- null
- query
- document
nullable: true
default: null
truncation:
type: boolean
description: 'Whether to truncate the inputs to fit within the context
length. Defaults to `true`. - If `true`, an over-length
input will be truncated to fit within the context length before
being vectorized by the embedding model. If the truncation happens
in the middle of an image, the entire image will be discarded.
- If `false`, an error will be raised if any input exceeds
the context length.
'
default: true
output_encoding:
type: string
description: 'Format in which the embeddings are encoded. Defaults
to `null`. - If `null`, the embeddings are represented
as a list of floating-point numbers.
- If `base64`,
the embeddings are represented as a Base64-encoded NumPy array
of single-precision floats.
'
enum:
- null
- base64
nullable: true
default: null
responses:
'200':
description: Success
content:
application/json:
schema:
properties:
object:
type: string
description: The object type, which is always `list`.
data:
type: array
description: An array of embedding objects.
items:
type: object
properties:
object:
type: string
description: The object type, which is always `embedding`.
embedding:
type: array
description: 'The embedding vector consists of a list of
floating-point numbers or a Base64-encoded NumPy array
depending on `output_encoding`. The length of this vector
varies depending on the specific model.
'
index:
type: integer
description: 'An integer representing the index of the embedding
within the list of embeddings.
'
model:
type: string
description: Name of the model.
usage:
type: object
properties:
text_tokens:
type: integer
description: The total number of text tokens in the list of
inputs.
image_pixels:
type: integer
description: The total number of image pixels in the list
of inputs.
total_tokens:
type: integer
description: The combined total of text and image tokens.
Every 560 pixels counts as a token.
4XX:
description: 'Client error This indicates an issue with the request
format or frequency. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'
content:
application/json:
schema:
properties:
detail:
type: string
description: The error message.
5XX:
description: 'Server Error This indicates our servers are experiencing
high traffic or having an unexpected issue. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'
/rerank:
post:
tags:
- Endpoints
summary: Rerankers
description: 'Voyage reranker endpoint receives as input a query, a list of
documents, and other arguments such as the model name, and returns a response
containing the reranking results.
'
operationId: reranker-api
requestBody:
content:
application/json:
schema:
type: object
required:
- query
- documents
- model
properties:
query:
type: string
description: 'The query as a string. The query can contain a maximum
of 4000 tokens for `rerank-2`, 2000 tokens for `rerank-2-lite`
and `rerank-1`, and 1000 tokens for `rerank-lite-1`.
'
documents:
type: array
description: "The documents to be reranked as a list of strings.\
\ - The number of documents cannot exceed 1000.
\
\ - The sum of the number of tokens in the query and the number\
\ of tokens in any single document cannot exceed 16000 for `rerank-2`;\
\ 8000 for `rerank-2-lite` and\_`rerank-1`; and 4000 for\_`rerank-lite-1`.\
\
- The total number of tokens, defined as \"the number\
\ of query tokens \xD7 the number of documents + sum of the number\
\ of tokens in all documents\", cannot exceed 600K for `rerank-2`\
\ and `rerank-2-lite`, and 300K for `rerank-1` and `rerank-lite-1`.\
\ Please see our FAQ.
\n"
items:
type: string
model:
type: string
description: 'Name of the model. Recommended options: `rerank-2`,
`rerank-2-lite`.
'
top_k:
type: integer
description: 'The number of most relevant documents to return. If
not specified, the reranking results of all documents will be
returned.
'
nullable: true
default: null
return_documents:
type: boolean
description: 'Whether to return the documents in the response. Defaults
to `false`. - If `false`, the API will return a list of
{"index", "relevance_score"} where "index" refers to the index
of a document within the input list.
- If `true`, the
API will return a list of {"index", "document", "relevance_score"}
where "document" is the corresponding document from the input
list.
'
default: false
truncation:
type: boolean
description: "Whether to truncate the input to satisfy the \"context\
\ length limit\" on the query and the documents. Defaults to `true`.\
\ - If `true`, the query and documents will be truncated\
\ to fit within the context length limit, before processed by\
\ the reranker model.
- If `false`, an error will be\
\ raised when the query exceeds 4000 tokens for `rerank-2`; 2000\
\ tokens `rerank-2-lite` and `rerank-1`; and 1000 tokens for `rerank-lite-1`,\
\ or the sum of the number of tokens in the query and the number\
\ of tokens in any single document exceeds 16000 for `rerank-2`;\
\ 8000 for `rerank-2-lite` and\_`rerank-1`; and 4000 for\_`rerank-lite-1`.\
\
\n"
default: true
responses:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
object:
type: string
description: The object type, which is always "list".
data:
type: array
description: 'An array of the reranking results, sorted by the
descending order of relevance scores.
'
items:
type: object
properties:
index:
type: integer
description: The index of the document in the input list.
relevance_score:
type: number
description: The relevance score of the document with respect
to the query.
document:
type: string
description: 'The document string. Only returned when return_documents
is set to true.
'
model:
type: string
description: Name of the model.
usage:
type: object
properties:
total_tokens:
type: integer
description: The total number of tokens used for computing
the reranking.
4XX:
description: 'Client error This indicates an issue with the request
format or frequency. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'
content:
application/json:
schema:
properties:
detail:
type: string
description: The error message.
5XX:
description: 'Server Error This indicates our servers are experiencing
high traffic or having an unexpected issue. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes)
guide.
'