Apex — CMMD Integration
How CMMD platform calls Apex endpoints.
Status: draft. Wiring not yet in CMMD code as of 2026-05-19. This page describes the intended integration. PR for the actual code change is tracked in FORGE-20.
Integration points in CMMD
Section titled “Integration points in CMMD”CMMD’s AI gateway lives at server/services/ai-gateway/. Key files for adding Apex:
| File | Change |
|---|---|
providers/AnthropicProvider.ts:182 | Add baseURL: this.config.apiBaseUrl to new Anthropic({...}) so custom base URLs work |
provider-factory-registry.ts | Register a new apex provider key alongside anthropic |
ai-model-registry-service.ts | Add apex-core (and lab-*) rows in HARDCODED_FALLBACK |
complexity-evaluator.ts | Optionally wire Apex as backing for FAST_MODEL / CAPABLE_MODEL / FLAGSHIP_MODEL constants |
Env vars needed
Section titled “Env vars needed”# Production endpoint (apex tier)APEX_API_KEY=<master_key>APEX_BASE_URL=https://apex-api.cmmd.ai
# Optional: experimental endpoint (lab tier) for non-production pathsLAB_APEX_API_KEY=<same as above>LAB_APEX_BASE_URL=https://lab-apex-api.cmmd.aiThe master key is the same for both endpoints. Stored in macOS Keychain (dev laptop) or as a CI secret.
Provider class skeleton
Section titled “Provider class skeleton”The simplest path is to instantiate AnthropicProvider with apex base URL via env override:
// in provider-factory-registry.tscase 'apex': { const { key, source } = resolveProviderApiKey('apex', context.env); if (!key) return { status: 'missing_credentials', reason: '...' }; return { runtime: new AnthropicProvider(buildProviderConfig('apex', key, { apiBaseUrl: context.env.APEX_BASE_URL || 'https://apex-api.cmmd.ai', })), status: 'ready', defaultModel: 'apex-core', };}AnthropicProvider needs the small change at line 182 to accept apiBaseUrl:
// Beforethis.client = new Anthropic({ apiKey: this.config.apiKey, timeout: 30_000 });
// Afterthis.client = new Anthropic({ apiKey: this.config.apiKey, baseURL: this.config.apiBaseUrl, // ← undefined for stock Anthropic, set for Apex timeout: 30_000,});Aliases CMMD should know
Section titled “Aliases CMMD should know”| Alias | When to use |
|---|---|
apex-core | Default for new feature integrations |
lab-flash | Quick classification, routing decisions, prompt-cache warming, doc tooling |
lab-general | Internal experimental tasks |
CMMD’s existing FAST_MODEL/CAPABLE_MODEL/FLAGSHIP_MODEL constants can map to Apex aliases via the registry — no code refactor needed.
Related
Section titled “Related”- Architecture — where each model lives
- API Reference — request shape
- Forge integration — parallel integration in cmmd-forge
- Source:
cmmd/server/services/ai-gateway/