> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Providers and models

> Understand how LangChain uses providers to give you a single API for any model from any provider

LangChain gives you a single, unified API to work with models from any provider. Install a provider package, pick a model name, and start building—the same code works whether you use OpenAI, Anthropic, Google, or any other supported provider.

```mermaid theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
graph LR
    subgraph "Your code"
        A["LangChain API<br/>(invoke, stream, bind_tools)"]
    end

    subgraph "Providers"
        B["OpenAI"]
        C["Anthropic"]
        D["Google"]
        E["AWS Bedrock"]
        F["...and more"]
    end

    A --> B
    A --> C
    A --> D
    A --> E
    A --> F

    classDef code fill:#E5F4FF,stroke:#006DDD,stroke-width:2px,color:#030710
    classDef provider fill:#EBD0F0,stroke:#885270,stroke-width:2px,color:#441E33

    class A code
    class B,C,D,E,F provider
```

## One API for any model

Every LangChain chat model, regardless of provider, implements the same interface. This means you can:

* **Swap providers** without rewriting application logic
* **Compare models** side-by-side with identical code
* **Use advanced features** like [tool calling](https://docs.langchain.com/oss/python/langchain/tools.md), [structured output](https://docs.langchain.com/oss/python/langchain/structured-output.md), and [streaming](https://docs.langchain.com/oss/python/langchain/streaming.md) across all providers

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain.chat_models import init_chat_model

openai_model = init_chat_model("openai:gpt-6.1-sol")
anthropic_model = init_chat_model("anthropic:claude-opus-4-8")
google_model = init_chat_model("google-genai:gemini-3.1-pro-preview")

for model in [openai_model, anthropic_model, google_model]:
    response = model.invoke("Explain quantum computing in one sentence.")
    print(response.text)
```

## What is a provider?

A **provider** is a company or platform that hosts AI models and exposes them through an API. Examples include OpenAI, Anthropic, Google, and AWS Bedrock.

In LangChain, each provider has a dedicated **integration package** (for example `langchain-openai`, `langchain-anthropic`) that implements the standard LangChain interface for that provider's models. This means:

* **Dedicated packages** for each provider with proper versioning and dependency management
* **Provider-specific features** are available when you need them (for example OpenAI's Responses API, Anthropic's extended thinking)
* **Automatic API key handling** through environment variables

```shell theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
uv add langchain-openai       # For OpenAI models
uv add langchain-anthropic    # For Anthropic models
uv add langchain-google-genai # For Google models
```

For a full list of provider packages, see the [integrations page](https://docs.langchain.com/oss/python/integrations/providers/overview.md).

## Find model names

Each provider supports specific model names that you pass when initializing a chat model. There are two ways to specify a model:

```python Provider prefix format theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain.chat_models import init_chat_model

model = init_chat_model("openai:gpt-6.1-sol")
```

```python Direct class instantiation theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_openai import ChatOpenAI

model = ChatOpenAI(model="gpt-6.1-sol")
```

When using [`init_chat_model`](https://reference.langchain.com/python/langchain/chat_models/base/init_chat_model) with the `provider:model` format, LangChain automatically resolves the provider and loads the correct integration package. You can also omit the provider prefix if the model name is unambiguous (e.g., `"gpt-6.1-sol"` resolves to OpenAI).

To find available model names for a provider, refer to the provider's own documentation. Here are some popular providers:

| Provider | Where to find model names |
| :- | :- |
| [OpenAI](https://docs.langchain.com/oss/python/integrations/providers/openai.md) | [OpenAI models page](https://platform.openai.com/docs/models) |
| [Anthropic](https://docs.langchain.com/oss/python/integrations/providers/anthropic.md) | [Anthropic models page](https://docs.anthropic.com/en/docs/about-claude/models) |
| [Google](https://docs.langchain.com/oss/python/integrations/providers/google.md) | [Google AI models page](https://ai.google.dev/gemini-api/docs/models) |
| [AWS Bedrock](https://docs.langchain.com/oss/python/integrations/providers/aws.md) | [Bedrock supported models](https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html) |
| [Ollama](https://docs.langchain.com/oss/python/integrations/providers/ollama.md) | [Ollama model library](https://ollama.com/library) |
| [Groq](https://docs.langchain.com/oss/python/integrations/providers/groq.md) | [Groq supported models](https://console.groq.com/docs/models) |

## Use new models immediately

Because LangChain provider packages pass model names directly to the provider's API, you can use new models the moment a provider releases them (no LangChain update required). Simply pass the new model name:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
model = init_chat_model("google_genai:gemini-mythos")
```

New model names work immediately as long as your provider package version supports the API version the model requires. In most cases, model releases are backward-compatible and require no package update.

## Model capabilities

Different providers and models support different features.
For a list of the chat model integrations and their capabilities, see the [chat models integrations page](https://docs.langchain.com/oss/python/integrations/chat.md).

## Routers and proxies

**Routers** (also called proxies or gateways) give you access to models from multiple providers through a single API and credential. They can simplify billing, let you switch between models without changing integrations, and offer features like automatic fallbacks and load balancing.

| Provider | Integration | Description |
| :- | :- | :- |
| [OpenRouter](https://openrouter.ai/) | [`ChatOpenRouter`](https://docs.langchain.com/oss/python/integrations/chat/openrouter) | Unified access to models from OpenAI, Anthropic, Google, Meta, and more |
| [LiteLLM](https://www.litellm.ai/) | [`ChatLiteLLM`](https://docs.langchain.com/oss/python/integrations/chat/litellm) | Unified interface for 100+ providers with routing, fallbacks, and spend tracking |

Routers are useful when you want to:

* **Access many providers** with a single API key and billing account
* **Switch models dynamically** without managing multiple provider credentials
* **Use fallback models** that automatically retry with a different model if the primary one fails

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain.chat_models import init_chat_model

model = init_chat_model("openrouter:anthropic/claude-sonnet-4-6")
response = model.invoke("Hello!")
```

## OpenAI-compatible endpoints

Many providers offer endpoints compatible with OpenAI's [Chat Completions API](https://platform.openai.com/docs/api-reference/chat). You can connect to these using [`ChatOpenAI`](https://docs.langchain.com/oss/python/integrations/chat/openai) with a custom `base_url`:

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    base_url="https://your-provider.com/v1",
    api_key="your-api-key",
    model="provider-model-name",
)
```

> [!WARNING]
>
> `ChatOpenAI` targets [official OpenAI API specifications](https://github.com/openai/openai-openapi) only. Non-standard response fields from third-party providers are not extracted or preserved. Use a dedicated provider package or router when you need access to non-standard features.

## Next steps

> [card] [Models guide](https://docs.langchain.com/oss/python/langchain/models.md)
>
> Learn how to use models: invoke, stream, batch, tool calling, and more.

> [card] [Chat model integrations](https://docs.langchain.com/oss/python/integrations/chat.md)
>
> Browse all chat model integrations and their capabilities.

> [card] [All providers](https://docs.langchain.com/oss/python/integrations/providers/overview.md)
>
> See the full list of provider packages and integrations.

> [card] [Agents](https://docs.langchain.com/oss/python/langchain/agents.md)
>
> Build agents that use models as their reasoning engine.

***

[Connect these docs](https://docs.langchain.com/use-these-docs.md) to your agent of choice via MCP for real-time answers.

[Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/concepts/providers-and-models.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
