Gateway
API reference for the LLM provider gateway in @cline/llms.
DefaultGateway creates provider-backed AgentModel instances and exposes provider/model catalog helpers.
import { DefaultGateway, createGateway } from "@cline/llms"Constructor
const gateway = new DefaultGateway({
providerConfigs: [
{ providerId: "anthropic", apiKey: process.env.ANTHROPIC_API_KEY },
],
})Or:
const gateway = createGateway({ providerConfigs: [...] })Methods
registerProvider(registration)
gateway.registerProvider(registration)Registers a GatewayProviderRegistration.
configureProvider(config)
gateway.configureProvider({
providerId: "anthropic",
apiKey: process.env.ANTHROPIC_API_KEY,
})Configures credentials/defaults for a provider.
listProviders()
const providers = gateway.listProviders()Returns registered provider manifests.
listModels(providerId?)
const allModels = gateway.listModels()
const anthropicModels = gateway.listModels("anthropic")Returns model metadata.
createAgentModel(selection, options?)
const model = gateway.createAgentModel({
providerId: "anthropic",
modelId: "claude-sonnet-4-6",
})Returns an AgentModel that can be passed to AgentRuntime.
stream(request)
const stream = await gateway.stream({
providerId: "anthropic",
modelId: "claude-sonnet-4-6",
messages,
tools: [],
})Returns AsyncIterable.
Registry Helpers
@cline/llms also exports:
getAllProvidersgetProviderIdsgetProvidergetModelsForProviderregisterProviderregisterModelcreateHandlercreateHandlerAsync
Built-In Provider Families
The runtime includes built-in registrations for provider families including Anthropic, OpenAI, Gemini, Vertex, Bedrock, Mistral, Claude Code, OpenAI Codex, OpenCode, Dify, and OpenAI-compatible providers.