We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.
We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.
mongodb/voyage-code-4Runs on your balance at the prices above. New accounts start with free usage.
Settings
VoyageAI by MongoDB: voyage-code-4 is a code embedding model from Voyage AI, a MongoDB company. It belongs to the embeddings category, so its job is to turn input into vectors rather than to generate chat responses. It is designed for coding agents and code retrieval, which places it in the part of a stack where you need to represent code as vectors that can be stored, compared and searched.
The model accepts text as input and produces embeddings as output. It has a context length of 32,000 tokens and a maximum output of 28,800, and it uses Matryoshka embeddings at 2048 dimensions. Matryoshka embeddings can be truncated to shorter lengths while remaining usable, which gives you flexibility in how much vector storage and compute you commit to. Because the input modality is text, the model works on code that has been serialized as text, which is how source files, diffs and snippets normally reach an embedding endpoint.
Those capabilities point to a fairly specific set of uses. Code retrieval is the core one: indexing a repository so that a search query, a natural language description or a fragment of code returns the most relevant files or functions. Coding agents can use the same embeddings to find relevant context before editing or generating code, which keeps the agent grounded in the actual codebase rather than relying on what fits in a prompt. The 32,000 token context means larger files or multi file chunks can be embedded in a single request, and the Matryoshka property lets you trade vector size against retrieval quality when you design your index.
You call the model through api14's OpenAI-compatible API using the model id "mongodb/voyage-code-4". Because the interface follows the OpenAI format, you can point an existing OpenAI client at api14 and send embedding requests without rewriting your integration. The model supports no additional request parameters, so you send the model id and your input text and read the returned vectors. There is no chat completion surface here, and no tool calling or structured output to configure.
Keep the scope in mind when choosing it. This is an embedding model, so it will not answer questions, write code or hold a conversation; pair it with a generative model if you need those behaviours. If your task is general purpose semantic search over prose rather than code, a text embedding model may fit better, and if you need generation you need a different model entirely. For code retrieval and coding agent context, voyage-code-4 is built for exactly that.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.embeddings.create({
"model": "mongodb/voyage-code-4",
"input": [
"The quick brown fox",
"Lorem ipsum"
]
});
console.log(result.data.map((d) => d.embedding.length));
This community has no topics yet. Open the first one about VoyageAI by MongoDB: voyage-code-4.