Source: https://ailoot.ai/models/en/voyage-code-2/
Canonical: https://ailoot.ai/models/en/voyage-code-2/
Language: en

# Voyage AI: Voyage Code 2

[Markdown](https://ailoot.ai/models/en/voyage-code-2/index.md) · [JSON](https://ailoot.ai/models/en/voyage-code-2/facts.json)

## [Voyage AI: Voyage Code 2](https://ailoot.ai/models/en/voyage-code-2/)

Voyage Code 2 embeds source code and related text for semantic repository search. Natural-language questions, code snippets or combined queries can retrieve relevant implementations; this edition uses a 16,000-token context window and 1,536-dimensional vectors.

- [**Ailoot Ultra · Embeddings** `POST /v1/embeddings` `voyage-code-2`](https://ailoot.ai/models/en/voyage-code-2/#method-0)

About the model

This description covers the model’s capabilities. Available in Ailoot inputs, outputs and options are listed for the selected method below.

Voyage Code 2 creates numerical embeddings for source code and related text. It is designed for semantic code retrieval, where a developer describes behavior or supplies a code fragment and the search system finds relevant implementations. The maker’s examples cover natural-language questions, code snippets and combinations of the two as search inputs.

Use it to build a repository search experience around actual development questions. A developer might look for the routine that removes only the first and last matching characters, or for the part of a project that applies a particular tree traversal. Prepare queries that express the behavior precisely, including the condition that distinguishes the intended implementation from a nearby but incorrect one.

Index code in useful units rather than splitting every file at an arbitrary character count. Keep a function signature, body and relevant explanation together. When a helper depends on local types or constants, retain enough surrounding text to make its purpose understandable. Store file paths, repository revisions and source locations outside the embedding so the result can open the original code directly.

This edition has a 16,000-token context window and produces 1,536-dimensional embeddings. Size the vector index for this representation and keep query and document embeddings associated with the same model. A collection already indexed with Voyage Code 2 can retain a consistent retrieval representation while its source records are updated. A move to another embedding edition should be treated as an index migration with an explicit comparison on the same repository.

For a natural-language query, describe the operation, inputs and relevant outcome. For a code query, include the fragment whose logic needs to be matched and explain any condition that matters to the search. A search for retry handling, for example, can specify whether the relevant code retries after a timeout or after a complete error response. The retrieved source should be checked for that distinction before it is used in an edit.

Keep documentation and source code traceable when both are indexed. An explanatory passage may be helpful context, while the implementation is the artifact a developer needs to inspect. Label these record types so a search page can show the correct destination and a coding assistant can distinguish a description from executable source.

Use the retrieved passages as context for repository navigation, implementation discovery or a coding assistant’s next step. Preserve the complete relevant snippet and its location when passing it onward. Similarity helps find candidate code; reviewing the actual inputs, side effects and contracts determines whether the candidate solves the current problem.

Evaluate retrieval on a set of real questions with known source answers. Include renamed functions, misleading comments, similar utilities with different edge cases and queries that use vocabulary absent from the code. Check whether the expected implementation appears among the useful results and whether the displayed snippet gives enough context to assess it. Retain those questions as the repository grows so changes to extraction, passage boundaries or indexing can be compared against the same tasks.

**Ailoot Ultra · Embeddings** `POST /v1/embeddings` `voyage-code-2`

[`voyage-code-2`](https://ailoot.ai/models/en/#m=voyage-code-2&route=Ultra&caller=voyage-code-2&fmt=embeddings)

Voyage AI /`voyage-code-2`

### Overview

Voyage Code 2 embeds source code and related text for semantic repository search. Natural-language questions, code snippets or combined queries can retrieve relevant implementations; this edition uses a 16,000-token context window and 1,536-dimensional vectors.

Accepted inputs

Text

Results

embedding

### Available in Ailoot · inputs & methods

**Ailoot Ultra · Embeddings** `POST /v1/embeddings`

Input types

`text`

Output types

`embedding`

| Field | Type | Requirement | Values & limits | Default |
| --- | --- | --- | --- | --- |
| Field`model` | Type`string` | RequirementRequired | Values & limits voyage-code-2 Conditions: Use the exact Ailoot model selector. | Default— |
| Field`input` | Type`string or array<string>` | RequirementRequired | Values & limits Conditions: A text or list of texts; keep one vector for every returned data item and its index. | Default— |

Method parameters and lifecycle

| Parameter | Contract |
| --- | --- |
| Parameter`content_type` | Contractapplication/json |
| Parameter`required` | Contractmodel, input |
| Parameter`optional` | Contract |
| Parameter`material_types` | Contracttext |
| Parameter`conditions` | ContractSend text with the selected model; retain every returned vector and its index. |

Lifecycle: `synchronous`

### Pricing

Tariff references do not add request options. Supported parameters are listed for the selected method.

Fast mode

Not specified When fast mode is selected

Flex mode

Not specified When flex mode is selected

Maximum reasoning effort

Not specified When maximum reasoning effort uses the default adjustment

#### Ailoot rates

#### Prices by configuration

| Configuration | Rate schedule | Charge |
| --- | --- | --- |
| ConfigurationBase token rates | Rate scheduleBase rate | Charge Input · Input tokens **$0.0004** / 1K tokens Output · Output tokens **$0** / 1K tokens Input · Cache read **—** / 1K tokens Input · Cache write **—** / 1K tokens Input · Cache write, 1 hour **—** / 1K tokens |

Ailoot reserves an estimated amount before a request. After the result, it settles the final charge from measured usage. Streaming settlement uses the final usage record. [How reservation and settlement work →](https://ailoot.ai/docs/en/billing/reserve/)

### Example requests

#### Ailoot Ultra · Embeddings

curl · save all vectors and usage

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
cat > request.json <<'JSON'
{
  "model": "voyage-code-2",
  "input": "The quick brown fox jumps over the lazy dog"
}
JSON
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/embeddings \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o embeddings.json
# Keep every data item and its index, the full usage object and response headers.
```

### Receive and save results

### Aliases

#### Model aliases

**Ailoot Ultra** [`voyage-code-2`](https://ailoot.ai/models/en/#m=voyage-code-2&route=Ultra&caller=voyage-code-2&fmt=embeddings)

#### Method path aliases

Use the method paths shown above.

#### Related caller IDs

[`voyage-code-2`](https://ailoot.ai/models/en/#m=voyage-code-2&route=Ultra&caller=voyage-code-2&fmt=embeddings)

FAQ · Voyage AI: Voyage Code 2

What inputs and results are available?

`POST /v1/embeddings` · `voyage-code-2`: `text` → `embedding`

Which fields does the request use?

`POST /v1/embeddings` · `voyage-code-2`: `model`, `input`

Connect Ailoot to Claude Code, OpenCode, Hermes or your own app.

## The company and its project portfolio

The company and its project portfolio: millions of customers; monthly sales in the billions.

## Buy tokens at a discount.

Subscription discounts for regular use. Promo codes offer up to 50% off token purchases.

Subscription

Choose a discounted plan for your regular requests.

Promo code: up to 50% off

Enter your code at checkout. The price updates to reflect the current promotion.

Spending in your history

The model, tokens and amount are recorded for each request.

[Choose a subscription](https://ailoot.ai/docs/en/billing/subscriptions/) · [View model prices](https://ailoot.ai/models/en/)

## Connect the API to a product you sell.

Use Ailoot in SaaS, apps and bots under its official service offer and licence agreement. Request a reseller licence for resale.

Commercial application

Add text, image, video and audio generation to paid features in your service.

Reseller licence

Send a description of your project and how you provide access. Request written terms for use and resale.

Documents on the website

The service offer, licence agreement and data processing policy are available before you connect.

[Request a reseller licence](mailto:support@ailoot.ai) · [Service offer and licence agreement](https://ailoot.ai/legal/offer?lang=en)

## Ailoot · The company and its project portfolio





Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.





The company and its project portfolio: millions of customers; monthly sales in the billions.





Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
