Voyage code 2 API

anthropic/voyage-code-2
Voyage Code 2 is an embedding model optimized for code retrieval, similarity search, and programming tasks.
Context
16K tokens
Input
$0.12 / 1M tokens
Output
Released
Dec 13, 2025

Overview

What is Voyage code 2 API?

Voyage Code 2 is an embedding model optimized for code retrieval, similarity search, and programming tasks.

Technical Specifications
- Supported inputs: Text
- Output: Embedding
- Context window: 16,000 tokens / Max output: —
- Endpoint: /embeddings

Performance Benchmarks
[embed]

Voyage code 2 API Pricing
- Input: $0.156 / 1M tokens

Where to Use Voyage code 2

Semantic search
Rank documents by meaning for retrieval and discovery.

RAG pipelines
Ground LLM answers in your own data via vector retrieval.

Code Sample
[embed]

Use cases

Voyage code 2 is documented as suited to semantic code retrieval, including searching for code from natural-language queries and finding similar code snippets. It is also documented for code completion tasks. It is further documented as useful for general code assistant applications.

How to use Voyage code 2 API

Install any OpenAI-compatible SDK, point it at api.aimlapi.com/v1, and set the model to anthropic/voyage-code-2.
import requests

r = requests.post(
    "https://api.aimlapi.com/v1/embeddings",
    headers={"Authorization": "Bearer " + AIMLAPI_KEY},
    json={
      "model": "anthropic/voyage-code-2",
      "input": "The quick brown fox"
    },
)
print(r.json())
const r = await fetch("https://api.aimlapi.com/v1/embeddings", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AIMLAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "anthropic/voyage-code-2",
    "input": "The quick brown fox"
  }),
});
console.log(await r.json());
curl -X POST https://api.aimlapi.com/v1/embeddings \
  -H "Authorization: Bearer $AIMLAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/voyage-code-2","input":"The quick brown fox"}'

OpenAI-compatible — swap the base URL and it works with your existing SDK.

Voyage code 2 API Pricing

TypePrice
Input
$0.12 / 1M tokens
Output

Voyage code 2 vs other models

ModelInputOutputContextBest for
Voyage code 2
This page
$0.12 / 1M tokens
16K tokens
Semantic search + RAG
$0.13 / 1M tokens
8K tokens
Semantic search + RAG
$0.02 / 1M tokens
8K tokens
Semantic search + RAG
$0.07 / 1M tokens
$0.074 / 1M tokens
8K tokens
Semantic search + RAG
$0.1 / 1M tokens
4K tokens
Semantic search + RAG

Frequently asked questions

Voyage code 2 takes text as input and returns embedding.

Voyage code 2 became available on December 13, 2025.

Voyage code 2 is priced at input $0.156 / 1M tokens.

Voyage code 2 was built by Anthropic.

Send a request to https://api.aimlapi.com/v1/embeddings with anthropic/voyage-code-2 as the model id.

Yes. Voyage code 2 is served through AI/ML API, so the same key and endpoint format used for other models applies.

It is an embedding model built for code retrieval, similarity search, and other programming-related tasks.

It is an embeddings model that converts text input into vector embeddings.

Start building with Voyage code 2

Get API Key
1000+ models, one API.