# Which LLM Providers Does Dexter Support? A Complete Guide to AI Model Integration

> Explore which LLM providers Dexter supports. This guide details integration with OpenAI, Gemini, Anthropic, and more for seamless AI model routing.

- Repository: [Virat Singh/dexter](https://github.com/virattt/dexter)
- Tags: how-to-guide
- Published: 2026-02-16

---

**Dexter supports seven LLM providers including OpenAI, Anthropic, Google Gemini, xAI, OpenRouter, and Ollama, automatically routing requests based on model name prefixes defined in [`src/model/llm.ts`](https://github.com/virattt/dexter/blob/main/src/model/llm.ts).**

The open-source Dexter project by `virattt/dexter` provides a flexible abstraction layer that lets you switch between commercial APIs and local models without changing your application code. Understanding which LLM providers Dexter supports helps you choose the right backend for your specific latency, cost, and privacy requirements.

## Supported LLM Providers in Dexter

Dexter implements a prefix-based routing system that maps model identifiers to specific provider clients. Here are the supported providers and their detection patterns:

### OpenAI (Default)

**OpenAI** serves as the default provider when no specific prefix is detected or when the model name starts with `gpt-`. Dexter ships with `gpt-5.2` configured out-of-the-box, making it the zero-configuration option for new deployments.

### Anthropic Claude

**Anthropic** powers the Claude family of models. When Dexter detects a model name prefixed with `claude-`, it automatically instantiates the Anthropic client and routes requests to Claude's API endpoints.

### Google Gemini

**Google's Gemini** models are accessible through the `gemini-` prefix. This includes both the standard Gemini Pro and the newer Gemini 1.5 Pro models, allowing Dexter to leverage Google's context window capabilities.

### xAI Grok

**xAI's Grok** models are supported through two prefix patterns: `grok-` or `xai-`. This flexibility accommodates different naming conventions users might encounter when working with xAI's API documentation.

### OpenRouter

**OpenRouter** acts as a unified gateway to multiple model providers. When Dexter sees the `openrouter-` prefix, it routes requests through OpenRouter's API, enabling access to models from providers not directly integrated into Dexter's native client list.

### Ollama (Local)

**Ollama** enables local, self-hosted model execution. Unlike prefix-based detection, Ollama activation relies on the presence of the `OLLAMA_BASE_URL` environment variable. When this variable is set, Dexter directs all model requests to the specified local Ollama server, bypassing commercial APIs entirely.

## How Dexter Detects and Routes LLM Providers

The provider selection logic resides in [`src/model/llm.ts`](https://github.com/virattt/dexter/blob/main/src/model/llm.ts), where Dexter implements a factory pattern that inspects model name prefixes and environment variables to instantiate the correct API client.

When you initialize a model through Dexter's CLI or programmatic API, the system performs the following checks in order:

1. **Environment Variable Check**: If `OLLAMA_BASE_URL` exists, Dexter creates an `OllamaClient` pointing to your local server.
2. **Prefix Matching**: The model string is parsed for provider-specific prefixes (`claude-`, `gemini-`, `grok-`, etc.).
3. **Default Fallback**: If no prefix matches and no Ollama URL is set, Dexter defaults to the OpenAI client.

This architecture makes adding new providers straightforward—you only need to extend the prefix mapping table in [`src/model/llm.ts`](https://github.com/virattt/dexter/blob/main/src/model/llm.ts) and implement the corresponding client wrapper.

## Configuring Providers in Dexter

### Switching Models via CLI

Dexter's interactive CLI, implemented in [`src/cli.tsx`](https://github.com/virattt/dexter/blob/main/src/cli.tsx), provides the `/model` command for runtime provider switching. The CLI uses the `useModel` hook from [`src/hooks/useModel.ts`](https://github.com/virattt/dexter/blob/main/src/hooks/useModel.ts) to manage state:

```typescript
// Example: Switching to Anthropic Claude via CLI
/model claude-3-opus-20240229

```

When you execute this command, Dexter parses the `claude-` prefix and immediately routes subsequent prompts to Anthropic's API endpoints.

### Using Local Ollama Instances

To configure Ollama support, set the environment variable before starting Dexter:

```bash
export OLLAMA_BASE_URL=http://localhost:11434

```

Once configured, you can reference any model available in your local Ollama installation:

```typescript
// In Dexter CLI or code
/model phi3
/model llama3
/model mistral

```

Dexter forwards these requests to your Ollama server without requiring API keys for commercial providers.

### Programmatic Model Selection

For applications building on top of Dexter, you can instantiate specific providers directly in TypeScript:

```typescript
import { LLM } from '@/model/llm';

// Initialize Google Gemini
const gemini = new LLM('gemini-1.5-pro');
const response = await gemini.generate('Explain quantum computing algorithms.');

// Initialize xAI Grok
const grok = new LLM('grok-1');
const analysis = await grok.generate('Analyze this market data...');

```

The `LLM` class constructor handles provider detection automatically based on the model name string you provide.

## Summary

- **Dexter supports seven LLM providers**: OpenAI, Anthropic, Google Gemini, xAI, OpenRouter, and Ollama (local).
- **Prefix-based routing** in [`src/model/llm.ts`](https://github.com/virattt/dexter/blob/main/src/model/llm.ts) automatically selects the correct API client based on model name patterns (`gpt-`, `claude-`, `gemini-`, etc.).
- **OpenAI is the default provider** when no specific prefix is detected, using `gpt-5.2` as the out-of-the-box model.
- **Ollama support** activates via the `OLLAMA_BASE_URL` environment variable, enabling completely local, self-hosted model execution.
- **Runtime switching** is available through the CLI's `/model` command or programmatically via the `LLM` class constructor.

## Frequently Asked Questions

### Which LLM provider is the default in Dexter?

**OpenAI serves as the default provider** when you don't specify a model prefix or set the `OLLAMA_BASE_URL` environment variable. Dexter ships with `gpt-5.2` configured as the default model, allowing immediate usage without additional configuration. The detection logic falls back to OpenAI when no specific provider prefix like `claude-` or `gemini-` is found in the model string.

### How do I switch between different LLM providers in Dexter?

You can switch providers **interactively via the CLI or programmatically in code**. In the CLI, use the `/model` command followed by the model identifier—for example, `/model claude-3-opus-20240229` routes to Anthropic, while `/model gemini-1.5-pro` uses Google. Programmatically, instantiate the `LLM` class with the desired model name: `new LLM('grok-1')` automatically creates an xAI client based on the prefix detection in [`src/model/llm.ts`](https://github.com/virattt/dexter/blob/main/src/model/llm.ts).

### Can I use local models with Dexter?

**Yes, Dexter fully supports local models via Ollama.** Set the `OLLAMA_BASE_URL` environment variable to point to your Ollama server (typically `http://localhost:11434`), and Dexter will route all model requests to your local instance. You can then use any model available in your Ollama installation—such as `phi3`, `llama3`, or `mistral`—without requiring API keys for commercial providers. This is ideal for privacy-sensitive applications or offline development.

### Does Dexter support OpenRouter for accessing multiple models?

**Yes, Dexter includes native support for OpenRouter.** When you prefix your model name with `openrouter-`, Dexter routes the request through OpenRouter's unified API, giving you access to hundreds of models from various providers without managing multiple API keys. For example, using `/model openrouter-anthropic/claude-3-opus` or `new LLM('openrouter-meta-llama/llama-3-70b')` leverages OpenRouter's aggregation layer while maintaining Dexter's consistent interface.