Where Are OpenClaude Provider Integrations Defined? The Complete Technical Guide
OpenClaude provider integrations are centralized in the src/integrations directory, which contains low-level gateway implementations for backend services, high-level vendor wrappers for model families, and the registry system that binds them together.
OpenClaude is an open-source CLI tool that unifies access to multiple large language model backends through a single interface. Understanding exactly where OpenClaude provider integrations are defined is critical for developers extending the codebase to support new models or debugging connection issues. According to the Gitlawb/openclaude source code, all provider-specific logic lives under a dedicated integrations layer with clear architectural separation between transport-level gateways and vendor-specific business logic.
The Root Directory: src/integrations
All OpenClaude provider integrations reside under the src/integrations directory at the repository root. This location serves as the single source of truth for how the CLI communicates with external AI services including OpenAI, Anthropic, Azure, Ollama, and others. The architecture follows a layered pattern that isolates raw HTTP protocol handling from high-level provider configuration and model metadata.
Gateway Implementations: Low-Level Backend Communication
Gateway modules handle the raw protocol translation between OpenClaude and each AI service. These files implement the common ProviderGateway interface used by the core CLI to ensure consistent request formatting, authentication, and response parsing across all backends.
Location and Structure
Gateway implementations are located in src/integrations/gateways/. Each file corresponds to a specific backend service and exports a class or object capable of creating authenticated clients for that provider.
Key gateway files defined in the OpenClaude repository include:
src/integrations/gateways/openrouter.ts– Routes requests through the OpenRouter aggregation servicesrc/integrations/gateways/azure-openai.ts– Handles Azure OpenAI Service authentication and regional endpointssrc/integrations/gateways/ollama.ts– Connects to local Ollama instancessrc/integrations/gateways/vertex.ts– Integrates with Google Cloud Vertex AI
Each gateway module exports a class (such as AzureOpenAIGateway) that implements the ProviderGateway interface, allowing the core application to interact with any backend through a uniform API regardless of the underlying transport protocol.
Vendor Wrappers: High-Level Provider Abstractions
While gateways manage transport logic, vendor wrappers provide convenient façades for specific model families. These modules in src/integrations/vendors/ abstract gateway details and expose provider-specific configuration presets, pricing metadata, and model capabilities for families like Anthropic-Claude, OpenAI-compatible, and Gemini.
Vendor File Locations
The vendor directory contains high-level integrations for major AI providers:
src/integrations/vendors/anthropic.ts– Wraps Claude model family configurations and Anthropic-specific parameterssrc/integrations/vendors/openai.ts– Provides OpenAI-compatible interfaces for GPT modelssrc/integrations/vendors/gemini.ts– Handles Google Gemini model integrationssrc/integrations/vendors/deepseek.ts– Supports DeepSeek AI model configurations
Vendor modules import the appropriate gateways from src/integrations/gateways/ and add provider-specific business logic, such as default temperature settings or token limit configurations, creating a cleaner API for the rest of the application.
Registry and Discovery System
OpenClaude uses a centralized registration system to make providers discoverable at runtime. This prevents hard-coding provider references throughout the CLI and enables dynamic provider loading based on available credentials and configuration.
Central Registry (src/integrations/registry.ts)
The src/integrations/registry.ts file registers each gateway and vendor into the ProviderRegistry class. This registry acts as a factory that instantiates the correct provider implementation based on configuration strings or model identifiers passed from the command line.
Public API Surface (src/integrations/index.ts)
The src/integrations/index.ts file re-exports all publicly usable symbols from the integrations layer. When the core CLI imports provider functionality, it sources from this index file rather than deep-linking into specific gateway or vendor modules, maintaining clean dependency boundaries.
Model-to-Provider Mapping (src/integrations/modelMapping.ts)
The src/integrations/modelMapping.ts file maintains the mapping between model identifiers (such as claude-opus-4-8) and their corresponding gateway or vendor implementations. This allows users to reference models by simple strings while the system resolves the correct provider backend through the registry.
Runtime Discovery (src/integrations/discoveryService.ts)
The src/integrations/discoveryService.ts utility, supported by src/integrations/discoveryCache.ts, enables the CLI to locate installed providers at startup. The discovery system checks for available credentials and reachable endpoints before attempting to route requests, caching results to avoid redundant network validation.
Working with OpenClaude Provider Integrations
To interact with the provider system programmatically, import the registry or specific gateways from the integrations directory.
// Import a specific provider gateway directly
import { AzureOpenAIGateway } from 'src/integrations/gateways/azure-openai';
// Create an authenticated client for Azure OpenAI
const client = AzureOpenAIGateway.createClient({
apiKey: process.env.AZURE_OPENAI_KEY,
endpoint: 'https://my-resource.openai.azure.com/',
});
For most use cases, access providers through the centralized registry to ensure your code respects the model-to-provider mappings:
// Pull a provider from the central registry
import { ProviderRegistry } from 'src/integrations/registry';
const claudeProvider = ProviderRegistry.get('anthropic');
This approach ensures your implementation benefits from the discovery system's validation logic and the centralized configuration defined in src/integrations/modelMapping.ts.
Summary
- OpenClaude provider integrations are organized under
src/integrations/with strict separation between transport and business logic layers. - Gateway implementations in
src/integrations/gateways/handle low-level API communication for services including Azure, OpenRouter, Ollama, and Vertex. - Vendor wrappers in
src/integrations/vendors/provide high-level abstractions for model families including Anthropic Claude, OpenAI GPT, Google Gemini, and DeepSeek. - Central registration occurs in
src/integrations/registry.ts, whilesrc/integrations/index.tsexposes the public API surface for consuming code. - Model resolution is handled by
src/integrations/modelMapping.ts, mapping model IDs likeclaude-opus-4-8to their respective provider classes. - Runtime discovery is managed by
src/integrations/discoveryService.tsand its cache layer insrc/integrations/discoveryCache.ts.
Frequently Asked Questions
What is the difference between gateways and vendors in OpenClaude?
Gateways are low-level transport modules located in src/integrations/gateways/ that handle HTTP authentication, request formatting, and raw API responses for specific backends like Azure OpenAI or Ollama. Vendors are high-level abstractions in src/integrations/vendors/ that wrap gateways to provide provider-specific configurations, pricing metadata, and model presets for families like Anthropic-Claude or OpenAI-compatible models.
How do I add a new provider integration to OpenClaude?
To add a new provider, create a gateway implementation in src/integrations/gateways/ that conforms to the ProviderGateway interface. Then add a corresponding vendor wrapper in src/integrations/vendors/ if the provider supports multiple models. Finally, register both components in src/integrations/registry.ts and add any model ID mappings to src/integrations/modelMapping.ts to make the provider available through the CLI.
Where does OpenClaude map model IDs to their respective providers?
Model-to-provider mapping occurs in src/integrations/modelMapping.ts. This file maintains the lookup table that translates user-facing model identifiers into the appropriate gateway or vendor class instantiated by the ProviderRegistry, allowing the system to resolve claude-opus-4-8 to the Anthropic vendor implementation at runtime.
How does OpenClaude discover available providers at runtime?
Runtime discovery is handled by src/integrations/discoveryService.ts, which scans for configured credentials and reachable endpoints during CLI startup. The service caches validation results in src/integrations/discoveryCache.ts to avoid redundant network checks, ensuring only validated providers appear in the active provider list available to users.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →