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.
VoyageAI by MongoDB: voyage-code-4
voyageai/voyage-code-4Try VoyageAI by MongoDB: voyage-code-4 now
Runs on your balance at the prices above. New accounts start with free usage.
Results will appear here.
Settings
VoyageAI by MongoDB: voyage-code-4 at a glance
- Input price is 500% higher than the median of 34 Embeddings models.
- Context window of 32,000 tokens, enough for long documents and multi-turn conversations.
About VoyageAI by MongoDB: voyage-code-4
voyage-code-4 is a code embedding model from Voyage AI, a MongoDB company. It belongs to the embeddings category rather than the chat or text generation family, so its job is to turn input into vectors rather than to write replies. The provider release date is 2026-08-13. If you are building retrieval, search or agent tooling around source code, this is the kind of model you would evaluate.
The model takes text as its only input modality and produces embeddings as its only output modality. Its context length is 32000 tokens, and the maximum output is 28800. The provider describes it as designed for coding agents and code retrieval, and it uses Matryoshka embeddings at 2048, 1024, 512 and 256 dimensions. Matryoshka embeddings mean the same vector can be truncated to a shorter dimension while remaining usable, which lets you trade storage and search speed against retrieval quality without re-embedding your corpus. No request parameters are listed as supported for this model.
Those capabilities point to a fairly specific set of uses. Code retrieval is the obvious one: indexing a repository so that a search query or a natural language question returns the most relevant files, functions or snippets. Coding agents can use the same embeddings to decide which parts of a codebase to pull into their working context, which matters when a repository is far larger than any single prompt. Because the vectors can be shortened, the same index can serve a fast first pass at 256 dimensions and a more precise rerank at 2048. Documentation search, duplicate or near duplicate code detection, and clustering of similar files are also natural fits, since all of them reduce to comparing vectors.
You call it through api14's OpenAI-compatible API using the model id "voyageai/voyage-code-4". Because the interface follows the OpenAI embeddings shape, existing clients and SDKs that already point at an OpenAI-compatible base URL should work with only the model id changed. The model supports text input and returns embeddings, with a context length of 32000 tokens and a maximum output of 28800. The supported parameters list is empty, so you should not expect to pass options such as dimensions, truncation or input type; send your text and read the vector back.
Two things are worth checking before you commit. First, this is an embedding model, so it will not answer questions or generate code; pair it with a generation model if you need an agent that both retrieves and responds. Second, the empty parameter list means dimension selection is not exposed as a request option, so if you need explicit control over output size at call time, confirm how that is handled before designing around it.
How to call the VoyageAI by MongoDB: voyage-code-4 API
- Create an API key in your dashboard.
- Install the official openai SDK for your language.
- Set baseURL to https://api14.com/api/v1 and model to "voyageai/voyage-code-4".
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": "voyageai/voyage-code-4",
"input": [
"The quick brown fox",
"Lorem ipsum"
]
});
console.log(result.data.map((d) => d.embedding.length));
Specifications
- Context length
- 32,000
- Max output
- 28,800
- Input
- text
- Output
- embeddings
Requests on api14 · last 7 days
VoyageAI by MongoDB: voyage-code-4: frequently asked questions
- How much does the VoyageAI by MongoDB: voyage-code-4 API cost?
- VoyageAI by MongoDB: voyage-code-4 costs Input $0.42 / 1M tokens. It is charged from your USD balance only for successful requests; failed requests are free.
- What is the context window of VoyageAI by MongoDB: voyage-code-4?
- VoyageAI by MongoDB: voyage-code-4 reads up to 32,000 tokens per request: prompt, history and documents together. It writes up to 28,800 output tokens per response.
- What can VoyageAI by MongoDB: voyage-code-4 do?
- VoyageAI by MongoDB: voyage-code-4 accepts text and returns embeddings.
- How do I call VoyageAI by MongoDB: voyage-code-4 from my code?
- Point any OpenAI SDK at https://api14.com/api/v1 and set the model to "voyageai/voyage-code-4". No other code changes. Copy a ready example from the code panel on this page.
- What are alternatives to VoyageAI by MongoDB: voyage-code-4?
- Comparable Embeddings models at a similar price: VoyageAI by MongoDB: voyage-multimodal-3.5, VoyageAI by MongoDB: voyage-4-large, OpenAI: Text Embedding 3 Large. Each runs through the same API key, so switching is one string.
VoyageAI by MongoDB: voyage-code-4 community
New topicThis community has no topics yet. Open the first one about VoyageAI by MongoDB: voyage-code-4.