# How to Configure MiniMax Embeddings for code-review-graph Semantic Search

> Configure MiniMax embeddings for code-review-graph semantic search. Set API keys, enable cloud processing, and specify the provider via CLI or Python for enhanced code search.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: how-to-guide
- Published: 2026-08-07

---

**To configure MiniMax embeddings for semantic search in code-review-graph, set the `MINIMAX_API_KEY` environment variable, optionally export `CRG_ACCEPT_CLOUD_EMBEDDINGS=1` to acknowledge cloud data processing, and specify `--embedding-provider minimax` via CLI or `provider="minimax"` in Python.**

The code-review-graph library supports multiple vector embedding backends for semantic code search, including the cloud-based MiniMax provider (`embo-01`). Configuring MiniMax embeddings enables high-quality 1536-dimensional vector representations of your codebase stored in a local SQLite database. This guide walks through the exact environment variables, CLI flags, and Python API calls required to enable MiniMax as implemented in [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py).

## Prerequisites: API Key and Cloud Egress Acknowledgment

Before initializing the MiniMax provider, you must satisfy two security requirements hardcoded in the source.

### Set the MiniMax API Key

The `MiniMaxEmbeddingProvider` class reads your API key from the `MINIMAX_API_KEY` environment variable. Without this variable, the provider cannot authenticate against the MiniMax endpoint at `https://api.minimax.io/v1/embeddings`.

```bash
export MINIMAX_API_KEY="your-minimax-api-key-here"

```

### Accept Cloud Data Processing

Because MiniMax is a third-party cloud service, the library implements a safety check in the `_warn_cloud_egress` function within [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py). Unless you set `CRG_ACCEPT_CLOUD_EMBEDDINGS=1`, the library prints a one-time warning about sending code snippets to external APIs.

```bash
export CRG_ACCEPT_CLOUD_EMBEDDINGS=1

```

## Configure MiniMax via Command Line Interface

The CLI entry point in [`code_review_graph/cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/cli.py) accepts an `--embedding-provider` argument that routes to the `get_provider` factory function. To use MiniMax for indexing your repository:

```bash
code-review-graph update \
    --embedding-provider minimax \
    --embedding-model embo-01 \
    --repo /path/to/your/repo

```

This command initializes a `MiniMaxEmbeddingProvider` instance with the `embo-01` model, batches your source files (default 100 texts per batch), and stores the resulting 1536-dimensional vectors in the SQLite database.

## Configure MiniMax Programmatically

For custom pipelines, instantiate `EmbeddingStore` with `provider="minimax"` or use the lower-level `get_provider` factory directly.

### Using EmbeddingStore for Search

The `EmbeddingStore` class manages the SQLite persistence layer and vector search logic. When you specify `provider="minimax"`, it internally calls `get_provider("minimax")` to construct the provider.

```python
from code_review_graph.embeddings import EmbeddingStore

# Initialize with MiniMax provider

store = EmbeddingStore(
    db_path="mygraph.db",
    provider="minimax",
    model="embo-01"
)

# Perform semantic search

results = store.search("how to build a spring service", limit=10)
for qualified_name, score in results:
    print(f"{score:.3f}  {qualified_name}")

```

### Direct Provider Access

If you need embeddings without SQLite storage, import `get_provider` to obtain a `MiniMaxEmbeddingProvider` instance:

```python
from code_review_graph.embeddings import get_provider

provider = get_provider(provider="minimax")

# Batch embed documents (automatic batching at 100 items)

vectors = provider.embed(["def foo(): pass", "class Bar:"])

# Embed a single query

query_vec = provider.embed_query("function that does nothing")

```

## MiniMax Implementation Details

Understanding the internal architecture helps debug configuration issues.

- **Model Specification**: The provider uses the `embo-01` model (`_MODEL` constant) producing 1536-dimensional vectors (`_DIMENSION` constant) as defined in [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py).
- **API Endpoint**: Requests route to `https://api.minimax.io/v1/embeddings` (`_ENDPOINT` constant) via the `_call_api` method, which includes retry logic for resilience.
- **Task Types**: The provider distinguishes between indexing (`task="db"`) and querying (`task="query"`) when calling the MiniMax API, automatically set by `embed()` versus `embed_query()` methods.
- **Integration Points**: During indexing, `embed_nodes` calls `self.provider.embed(texts)` to populate the SQLite `embeddings` table. At query time, `search` uses `self.provider.embed_query(query)` to vectorize the search phrase before computing cosine similarity.

## Summary

- Export `MINIMAX_API_KEY` to authenticate with the MiniMax cloud API endpoint.
- Set `CRG_ACCEPT_CLOUD_EMBEDDINGS=1` to suppress the cloud egress warning implemented in `_warn_cloud_egress`.
- Use `--embedding-provider minimax` with the CLI or `provider="minimax"` with the `EmbeddingStore` constructor.
- The provider generates 1536-dimensional vectors using the `embo-01` model with automatic batching of 100 texts per request handled by `_call_api`.
- Core implementation resides in [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py) with CLI argument parsing in [`code_review_graph/cli.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/cli.py).

## Frequently Asked Questions

### What embedding model does the MiniMax provider use?

The `MiniMaxEmbeddingProvider` hardcodes the `embo-01` model, which produces 1536-dimensional vectors suitable for high-accuracy semantic code search. This is defined as the `_MODEL` constant in [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py).

### Can I use MiniMax embeddings without storing them in SQLite?

Yes. Instead of using `EmbeddingStore`, call `get_provider("minimax")` to obtain a raw provider instance. You can then call `provider.embed()` for documents or `provider.embed_query()` for search queries without database persistence.

### Why do I need to set CRG_ACCEPT_CLOUD_EMBEDDINGS?

This environment variable acknowledges that your code snippets will be sent to MiniMax's cloud API (`https://api.minimax.io`). The `_warn_cloud_egress` function in [`code_review_graph/embeddings.py`](https://github.com/tirth8205/code-review-graph/blob/main/code_review_graph/embeddings.py) enforces this opt-in to prevent accidental data leakage to third-party services.

### Is there a limit to how many files I can embed at once?

The `MiniMaxEmbeddingProvider` automatically handles batching with a default size of 100 texts per API call. You can embed thousands of files; the provider will chunk them appropriately in the `_call_api` method to respect rate limits and payload size constraints.