Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion docs/content/docs/(guides)/settings/core.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ Configure your acontext core services using these essential environment variable

<ParamField path="LLM_API_KEY" type="string" required>
API key for your LLM provider (OpenAI or Anthropic). This is the primary authentication credential for AI model access.
Use your MiniMax API key with either compatible protocol.
</ParamField>

<ParamField path="LLM_BASE_URL" type="string" default="null">
Custom base URL for LLM API endpoints. Leave unset to use the provider's default endpoint.
</ParamField>

<ParamField path="LLM_SDK" type="string" default="openai">
LLM provider to use. Supported values: `openai`, `anthropic`
LLM protocol adapter to use. Supported values: `openai`, `anthropic`, `minimax`. The `minimax` value uses the OpenAI-compatible adapter.
</ParamField>

<ParamField path="LLM_SIMPLE_MODEL" type="string" default="gpt-4.1">
Default model identifier for LLM operations. Examples: `gpt-4`, `gpt-3.5-turbo`, `claude-3-sonnet`
For MiniMax, use `MiniMax-M3` or `MiniMax-M2.7`.
</ParamField>

<ParamField path="LLM_RESPONSE_TIMEOUT" type="float" default="60">
Expand Down Expand Up @@ -78,6 +80,38 @@ BLOCK_EMBEDDING_DIM=1536
BLOCK_EMBEDDING_SEARCH_COSINE_DISTANCE_THRESHOLD=0.8
```

```bash title="MiniMax Global - OpenAI"
LLM_API_KEY=your-minimax-api-key
LLM_BASE_URL=https://api.minimax.io/v1
LLM_SDK=minimax
LLM_SIMPLE_MODEL=MiniMax-M3
LLM_RESPONSE_TIMEOUT=60
```

```bash title="MiniMax Global - Anthropic"
LLM_API_KEY=your-minimax-api-key
LLM_BASE_URL=https://api.minimax.io/anthropic
LLM_SDK=anthropic
LLM_SIMPLE_MODEL=MiniMax-M3
LLM_RESPONSE_TIMEOUT=60
```

```bash title="MiniMax China - OpenAI"
LLM_API_KEY=your-minimax-api-key
LLM_BASE_URL=https://api.minimaxi.com/v1
LLM_SDK=minimax
LLM_SIMPLE_MODEL=MiniMax-M2.7
LLM_RESPONSE_TIMEOUT=60
```

```bash title="MiniMax China - Anthropic"
LLM_API_KEY=your-minimax-api-key
LLM_BASE_URL=https://api.minimaxi.com/anthropic
LLM_SDK=anthropic
LLM_SIMPLE_MODEL=MiniMax-M2.7
LLM_RESPONSE_TIMEOUT=60
```

```bash title="Anthropic Setup"
# Using Anthropic Claude
LLM_API_KEY=your-anthropic-api-key
Expand Down Expand Up @@ -117,6 +151,25 @@ BLOCK_EMBEDDING_DIM=1024
```
</CodeGroup>

### MiniMax Models

| Model | Context window | Input modalities | Thinking |
| --- | ---: | --- | --- |
| `MiniMax-M3` | 1,000,000 tokens | Text, image, video | Adaptive or disabled |
| `MiniMax-M2.7` | 204,800 tokens | Text | Always on |

Global pay-as-you-go prices are in USD per million tokens.

| Model | Service tier | Input length | Input | Output | Cache read | Cache write |
| --- | --- | --- | ---: | ---: | ---: | ---: |
| `MiniMax-M3` | Standard | Up to 512,000 tokens | $0.30 | $1.20 | $0.06 | Not available |
| `MiniMax-M3` | Standard | More than 512,000 tokens | $0.60 | $2.40 | $0.12 | Not available |
| `MiniMax-M3` | Priority | Up to 512,000 tokens | $0.45 | $1.80 | $0.09 | Not available |
| `MiniMax-M3` | Priority | More than 512,000 tokens | $0.90 | $3.60 | $0.18 | Not available |
| `MiniMax-M2.7` | Default | Any supported length | $0.30 | $1.20 | $0.06 | $0.375 |

See the [MiniMax model reference](https://platform.minimax.io/docs/api-reference/api-overview) and [current pricing](https://platform.minimax.io/docs/guides/pricing-paygo) for updates.

## Appendix

<AccordionGroup>
Expand Down
7 changes: 4 additions & 3 deletions src/client/acontext-cli/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,10 @@ func runServerUp(cmd *cobra.Command, args []string) error {
if _, err := os.Stat(envFile); os.IsNotExist(err) {
envConfig := &docker.EnvConfig{
LLMConfig: &docker.LLMConfig{
APIKey: "your-api-key",
BaseURL: "https://api.openai.com/v1",
SDK: "openai",
APIKey: "your-api-key",
BaseURL: "https://api.openai.com/v1",
SimpleModel: "gpt-4.1",
SDK: "openai",
},
RootAPIBearerToken: "your-root-api-bearer-token",
CoreConfigYAMLFile: "./config.yaml",
Expand Down
10 changes: 7 additions & 3 deletions src/client/acontext-cli/internal/docker/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func GenerateEnvFile(filePath string, config *EnvConfig) error {
# LLM Configuration
LLM_API_KEY={{.LLMAPIKey}}
LLM_BASE_URL={{.LLMBaseURL}}
LLM_SIMPLE_MODEL={{.LLMSimpleModel}}
LLM_SDK={{.LLMSDK}}

# API Bearer Token (for root API access)
Expand All @@ -36,12 +37,14 @@ CORE_CONFIG_YAML_FILE={{.CoreConfigYAMLFile}}
vars := struct {
LLMAPIKey string
LLMBaseURL string
LLMSimpleModel string
LLMSDK string
RootAPIBearerToken string
CoreConfigYAMLFile string
}{
LLMAPIKey: config.LLMConfig.APIKey,
LLMBaseURL: config.LLMConfig.BaseURL,
LLMSimpleModel: config.LLMConfig.SimpleModel,
LLMSDK: config.LLMConfig.SDK,
RootAPIBearerToken: config.RootAPIBearerToken,
CoreConfigYAMLFile: config.CoreConfigYAMLFile,
Expand Down Expand Up @@ -69,9 +72,10 @@ CORE_CONFIG_YAML_FILE={{.CoreConfigYAMLFile}}

// LLMConfig contains LLM configuration
type LLMConfig struct {
APIKey string
BaseURL string
SDK string
APIKey string
BaseURL string
SimpleModel string
SDK string
}

// EnvConfig contains all environment configuration
Expand Down
15 changes: 11 additions & 4 deletions src/client/acontext-cli/internal/docker/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ func TestGenerateEnvFile(t *testing.T) {
// Create mock env config for testing
envConfig := &EnvConfig{
LLMConfig: &LLMConfig{
APIKey: "test-api-key",
BaseURL: "https://api.example.com",
SDK: "openai",
APIKey: "test-api-key",
BaseURL: "https://api.example.com",
SimpleModel: "test-model",
SDK: "openai",
},
RootAPIBearerToken: "test-root-token",
}
Expand All @@ -63,19 +64,23 @@ func TestGenerateEnvFile(t *testing.T) {
// Check for required environment variables
assert.Contains(t, contentStr, "LLM_API_KEY=")
assert.Contains(t, contentStr, "LLM_BASE_URL=")
assert.Contains(t, contentStr, "LLM_SIMPLE_MODEL=")
assert.Contains(t, contentStr, "LLM_SDK=")
assert.Contains(t, contentStr, "ROOT_API_BEARER_TOKEN=")

// Verify config values are not empty
lines := strings.Split(contentStr, "\n")
var llmAPIKey, llmBaseURL, llmSDK, rootToken string
var llmAPIKey, llmBaseURL, llmSimpleModel, llmSDK, rootToken string
for _, line := range lines {
if strings.HasPrefix(line, "LLM_API_KEY=") {
llmAPIKey = strings.TrimPrefix(line, "LLM_API_KEY=")
}
if strings.HasPrefix(line, "LLM_BASE_URL=") {
llmBaseURL = strings.TrimPrefix(line, "LLM_BASE_URL=")
}
if strings.HasPrefix(line, "LLM_SIMPLE_MODEL=") {
llmSimpleModel = strings.TrimPrefix(line, "LLM_SIMPLE_MODEL=")
}
if strings.HasPrefix(line, "LLM_SDK=") {
llmSDK = strings.TrimPrefix(line, "LLM_SDK=")
}
Expand All @@ -85,10 +90,12 @@ func TestGenerateEnvFile(t *testing.T) {
}
assert.NotEmpty(t, llmAPIKey)
assert.NotEmpty(t, llmBaseURL)
assert.NotEmpty(t, llmSimpleModel)
assert.NotEmpty(t, llmSDK)
assert.NotEmpty(t, rootToken)
assert.Equal(t, "test-api-key", llmAPIKey)
assert.Equal(t, "https://api.example.com", llmBaseURL)
assert.Equal(t, "test-model", llmSimpleModel)
assert.Equal(t, "openai", llmSDK)
assert.Equal(t, "test-root-token", rootToken)
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/core/acontext_core/llm/complete/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
FACTORIES: Mapping[str, COMPLETE_FUNC] = {
"openai": openai_complete,
"anthropic": anthropic_complete,
"minimax": openai_complete,
"mock": mock_complete,
}

Expand Down Expand Up @@ -61,7 +62,7 @@ async def llm_sanity_check():


def response_to_sendable_message(message: LLMResponse) -> dict:
if DEFAULT_CORE_CONFIG.llm_sdk == "openai":
if DEFAULT_CORE_CONFIG.llm_sdk in ("openai", "minimax"):
return message.raw_response.choices[0].message.model_dump()
elif DEFAULT_CORE_CONFIG.llm_sdk == "anthropic":
dp = {"role": message.role, "content": []}
Expand Down
2 changes: 1 addition & 1 deletion src/server/core/acontext_core/schema/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CoreConfig(BaseModel):
llm_openai_default_header: Optional[Mapping[str, Any]] = None
llm_openai_completion_kwargs: Mapping[str, Any] = {}
llm_response_timeout: float = 60
llm_sdk: Literal["openai", "anthropic", "mock"] = "openai"
llm_sdk: Literal["openai", "anthropic", "minimax", "mock"] = "openai"

llm_simple_model: str = "gpt-4.1"

Expand Down
15 changes: 15 additions & 0 deletions src/server/core/tests/llm/test_provider_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from acontext_core.llm.complete import FACTORIES
from acontext_core.llm.complete.openai_sdk import openai_complete
from acontext_core.schema.config import CoreConfig


def test_minimax_uses_openai_compatible_adapter():
config = CoreConfig(
llm_api_key="test-key",
llm_base_url="https://api.minimax.io/v1",
llm_sdk="minimax",
llm_simple_model="MiniMax-M3",
)

assert config.llm_sdk == "minimax"
assert FACTORIES[config.llm_sdk] is openai_complete