Skip to content

gateway: add inference provider abstraction with MiniMax path - #68

Open
octo-patch wants to merge 1 commit into
Intent-Lab:mainfrom
octo-patch:octo/20260729-provider-add-recvqatBtsDNOA
Open

gateway: add inference provider abstraction with MiniMax path#68
octo-patch wants to merge 1 commit into
Intent-Lab:mainfrom
octo-patch:octo/20260729-provider-add-recvqatBtsDNOA

Conversation

@octo-patch

Copy link
Copy Markdown

Reason: The gateway hard-wires a single bare inference client and model, so there is no abstraction to route the agent through the MiniMax provider.

What changed

  • Add gateway/src/providers.ts: a small inference-provider registry. Each entry declares its default model, API-key environment variable, and any regional Anthropic-compatible base URLs. The existing default provider and MiniMax are registered.
  • gateway/src/config.ts: resolve the provider from INFERENCE_PROVIDER (default preserves today's behaviour) and PROVIDER_REGION, and expose the resolved base URL, API-key env name, and a provider-aware default for AGENT_MODEL. Warns when the selected provider's API key is missing.
  • gateway/src/cma.ts: build the shared client with the resolved base URL and API key so the same @anthropic-ai/sdk client reaches the selected provider's endpoint. When no override is set the client behaves exactly as before.
  • gateway/.env.example: document INFERENCE_PROVIDER, PROVIDER_REGION, and MINIMAX_API_KEY.

MiniMax exposes an Anthropic-compatible endpoint, so it is reached through the existing client by overriding baseURL — no second SDK is added. Selecting minimax defaults the model to MiniMax-M3 and targets https://api.minimax.io/anthropic (global) or https://api.minimaxi.com/anthropic (cn_zh).

Checks

  • npm ci
  • npm run typecheck (tsc --noEmit) — passes
  • Ran a short script exercising the resolver: the default provider yields no base-URL override, minimax resolves to MiniMax-M3 with the global endpoint, cn_zh resolves to the regional endpoint, and unknown provider/region values fall back with a warning.

Introduce a provider registry so the managed-agent client can route to an
Anthropic-compatible endpoint. Adds MiniMax (MiniMax-M3, global_en/cn_zh
regional base URLs) alongside the existing default provider, selected via
INFERENCE_PROVIDER/PROVIDER_REGION. Default behaviour is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant