Skip to content

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.

CMMD’s AI gateway lives at server/services/ai-gateway/. Key files for adding Apex:

FileChange
providers/AnthropicProvider.ts:182Add baseURL: this.config.apiBaseUrl to new Anthropic({...}) so custom base URLs work
provider-factory-registry.tsRegister a new apex provider key alongside anthropic
ai-model-registry-service.tsAdd apex-core (and lab-*) rows in HARDCODED_FALLBACK
complexity-evaluator.tsOptionally wire Apex as backing for FAST_MODEL / CAPABLE_MODEL / FLAGSHIP_MODEL constants
Terminal window
# 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 paths
LAB_APEX_API_KEY=<same as above>
LAB_APEX_BASE_URL=https://lab-apex-api.cmmd.ai

The master key is the same for both endpoints. Stored in macOS Keychain (dev laptop) or as a CI secret.

The simplest path is to instantiate AnthropicProvider with apex base URL via env override:

// in provider-factory-registry.ts
case '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:

// Before
this.client = new Anthropic({ apiKey: this.config.apiKey, timeout: 30_000 });
// After
this.client = new Anthropic({
apiKey: this.config.apiKey,
baseURL: this.config.apiBaseUrl, // ← undefined for stock Anthropic, set for Apex
timeout: 30_000,
});
AliasWhen to use
apex-coreDefault for new feature integrations
lab-flashQuick classification, routing decisions, prompt-cache warming, doc tooling
lab-generalInternal experimental tasks

CMMD’s existing FAST_MODEL/CAPABLE_MODEL/FLAGSHIP_MODEL constants can map to Apex aliases via the registry — no code refactor needed.