Voyage: Voyage Code 2
voyage-code-2- Input / Output
- $0.12 / $0.00
- Context
- 16K
- Modalities
- Embedding
About Voyage Code 2
Voyage Code 2 is an earlier Voyage AI embedding model specialized for source-code retrieval. It stays useful for code-search indexes already built with it, while new deployments can evaluate Voyage Code 3 or the newer Voyage Code 4. Voyage's current embeddings page no longer lists it.
Where it works well
- It was built for retrieving source code from natural-language questions.
- Existing code-search indexes built with it keep working unchanged.
- Its input limit is shorter than the newer Series 4 models.
- It predates Voyage Code 3, so a side-by-side test shows what a migration would change.
When to choose another model
- Voyage's current documentation does not list it, so there is little maintained guidance for it.
- Voyage Code 3 and Voyage Code 4 are newer code models that new projects should compare first.
Getting started
Create API key
Create a key in Console, then use it with every model on the platform.
Send your first request
Copy the example for your language and run it against the endpoint.
EmbeddingTokenLab endpointPOST/v1/embeddingscurl -X POST "https://api.tokenlab.sh/v1/embeddings" \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "encoding_format": "float", "model": "voyage-code-2", "input": "The quick brown fox jumps over the lazy dog." }'
Parameters
Embedding
| Parameter | Values and limits | Default | Notes |
|---|---|---|---|
encoding_format | Not provided | Not provided | This field is accepted. The current public contract does not specify a complete value range or list. No additional values are promised. The omitted-field default is not verified. |
input | Not provided | Not provided | Not provided |
Pricing
The Verified price applies to Verified, which costs less on most models. The Official price is the model maker's published price and applies to the more reliable Official route. Auto bills the route that completes the request.
Embedding
per 1M tokens- Official price
- Input $0.12 / Output $0.00
- Verified price
- —
- Discount
- —
| Official priceper 1M tokens | Verified priceper 1M tokens | Discount | |
|---|---|---|---|
| Embedding | Input $0.12 / Output $0.00 | — | — |
Usage & activity
Success rate is the share of requests that completed. Latency is how long a full response takes; P95 means 95% of requests finished within that time.
Usage & availability
Last 24 hours- Requests
- Success rate
- P95 latency
- Total tokens
Data is based on aggregate user requests, excluding status checks.
Open in Console
Open Voyage Code 2 in Console with a prompt ready to edit or send.
Help me try voyage-code-2 with embedding at /v1/embeddings. Show the result and cost.
Use cases
Keeping a code index alive
Embed new commits with the same model that produced the existing repository vectors.
Migration comparison
Measure its retrieval against Voyage Code 3 on real developer questions before re-indexing.
Small-snippet search
Search short functions and snippets where inputs stay well under the model's shorter input limit.
Prompt examples
Embed the query: function that parses an ISO date string.
Embed this Go handler as a document for the internal code index.
Embed the query: how is the cache invalidated after a write?
This model has conditional pricing. Monthly token totals alone cannot produce a reliable estimate; use the detailed pricing for the request specification, cache, and applicable time window.
FAQ
Is Voyage Code 2 still worth using?
Only when an existing code index depends on it. It is an earlier generation, and Voyage's current embeddings documentation no longer lists it. For new indexes, compare Voyage Code 3 or Voyage Code 4 first.
What does Voyage Code 2 retrieve?
Source code. It maps natural-language questions and code into one vector space so a query returns the matching snippet or file. It is not tuned for general prose, finance, or legal text.
How do I move from Voyage Code 2 to Voyage Code 3?
Re-embed every stored code chunk with Voyage Code 3, then embed queries with the same model. Vectors from different models cannot be mixed, so compare recall on real queries before switching the live index.
Does Voyage Code 2 accept long files?
Its input limit is shorter than the newer Voyage models, so split large files into functions or sections before embedding. Smaller chunks also make results more precise.
How much does Voyage Code 2 cost?
On TokenLab, Voyage Code 2 costs Input $0.12 / Output $0.00 per 1M tokens. The pricing table above shows the full breakdown. Rates depend on the billing unit, specification, and usage. Compare matching conditions in the model's detailed pricing; a single rate does not determine the total cost.
Which endpoint should Voyage Code 2 use?
Use https://api.tokenlab.sh/v1/embeddings for Voyage Code 2. The request example below shows the matching code shape.
Which operations does Voyage Code 2 support?
Voyage Code 2 supports Embedding. Select an operation above to see its endpoint and request example.
Compare Voyage Code 2
Sources
Reviewed Oct 2, 2026