mongodb · Embeddings

VoyageAI by MongoDB: voyage-code-4 API

VoyageAI by MongoDB: voyage-code-4 from mongodb converts text into numerical vectors for similarity search. It is an embedding service, so the response is a vector rather than a chat answer.

Available

Toman per million tokens

Input48,271

The usage rate is fixed at request admission. Reported consumption determines the final usage amount.

API model ID
or-mongodbvoyage-code-4-11bb02305c
Model developer
mongodb
Service type
Embeddings
Current availability
Available
Configured context limit
32,000 tokens

Model features

No additional gateway capabilities have been confirmed for this model.

What is VoyageAI by MongoDB: voyage-code-4?

Use the public identifier or-mongodbvoyage-code-4-11bb02305c for VoyageAI by MongoDB: voyage-code-4 in ServerNet. The gateway uses this identifier to select the configured route; the developer is mongodb.

For VoyageAI by MongoDB: voyage-code-4, measure whether the generated code passes your project tests. A plausible explanation alone does not verify program behaviour.

Where to use VoyageAI by MongoDB: voyage-code-4

  • Index document chunks with VoyageAI by MongoDB: voyage-code-4 for semantic search.
  • Embed the search query with the same VoyageAI by MongoDB: voyage-code-4 model used to build your index.
  • Evaluate retrieval quality before combining the results with a text-generation model.

Model description

Original catalogue description in English. It describes the model; the gateway limits and availability on this page define what you can request here.

voyage-code-4 is a code embedding model from Voyage AI, a MongoDB company. It is designed for coding agents and code retrieval, with Matryoshka embeddings at 2048t voyage-code-4 here: [mongodb.com/products/platform/ai-search-and-retrieval/models](

SELECTION NOTES

How to evaluate this model

For VoyageAI by MongoDB: voyage-code-4, compare the accepted input format and billing basis with alternatives in the same operation.

Before you integrate

  • Use a representative test set and check factual accuracy, format and failure cases.
  • Keep the first request bounded. Follow the operation-specific example and its API scope.
  • Record response time and usage in your own environment before setting a production budget.

Document search

Test retrieval relevance, vector compatibility and input limits on your corpus.

Compare models ↗

Build your integration

Send a string or a list of strings to /v1/embeddings. Store the returned vectors in your search index. When switching models, rebuild the index and check vector dimensions instead of mixing incompatible vectors.

Inputs and service limits

The route accepts plain text and batches of up to 128 texts. Token ID arrays, media inputs and unsupported output formats are refused. Choose chunk sizes within the model’s configured input limit.

A request cost example

For 1,000 input tokens and 0 output tokens, without a cache discount. This is a catalogue estimate, not a fixed request fee. Reported consumption and the price frozen for your request determine the usage amount.

Estimated usage, Toman
50

Plan your token usage

Estimate from the displayed uncached token rates. This is a planning calculation; final billing follows actual usage and the applicable request contract.

Tokens are not words. Cached input, special modes and reported usage can change the final amount.

This calculator runs locally and makes no AI request.
Rate-based estimate · IRT—Per request · IRT: —

Connect to VoyageAI by MongoDB: voyage-code-4 API

Enable ai:embedding on your key and ai:models:read to check availability. Set SERVERNET_API_KEY in your server environment. Change the idempotency key for each new request; keep it unchanged only for an identical retry.

ai:embedding
curl https://servernet.cloud/v1/embeddings \
  -H "Authorization: Bearer $SERVERNET_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: CHANGE_FOR_EACH_NEW_REQUEST' \
  -d '{
    "model": "or-mongodbvoyage-code-4-11bb02305c",
    "input": [
        "Hello world",
        "Search documents"
    ]
}'

Use the same Idempotency-Key when retrying an identical request. Successful responses are replayed without a second charge for 24 hours. Do not automatically retry when x-should-retry:false is present. The key is shown once. Store it in a server environment variable. Keep it out of browser code, GitHub and logs.

Keys, budgets and usage reports

Frequently asked questions

Is VoyageAI by MongoDB: voyage-code-4 available through ServerNet?

VoyageAI by MongoDB: voyage-code-4 is currently available on the configured route. Check GET /v1/models before sending a request: availability can change with provider capacity, catalogue freshness or account configuration.

Which model ID and API endpoint should I use for VoyageAI by MongoDB: voyage-code-4?

Use or-mongodbvoyage-code-4-11bb02305c as the model field, the endpoint shown below and the matching key scope. ServerNet keys are project-specific; an SDK also needs https://servernet.cloud/v1 as its base URL.

How is VoyageAI by MongoDB: voyage-code-4 usage charged?

Only input tokens are billed for this embedding route. A returned vector is not billable generated text. Each text in a batch contributes to input consumption.

What should I check before using VoyageAI by MongoDB: voyage-code-4 in production?

The route accepts plain text and batches of up to 128 texts. Token ID arrays, media inputs and unsupported output formats are refused. Choose chunk sizes within the model’s configured input limit.

Compare models for the same task

Only available models are exposed by the API. Availability requires a configured provider, valid prices and a supported execution path.