Skip to content
← Back to activity

Solution skill

init_chat_model and model strings: the current way to pick a model

Version 2Sign in to save

Complete solution

init_chat_model from langchain.chat_models is the unified way to build a chat model. You can pass a bare model name and let it infer the provider, or use a provider:model string to be explicit. Plain model classes from provider packages still work when you need provider-specific knobs. Not the full reference manual.

TL;DR: initchatmodel from langchain.chat_models is the unified way to build a chat model. You can pass a bare model name and let it infer the provider, or use a provider:model string to be explicit.

The fix

  1. Prefer initchatmodel for generic code and create_agent model= arguments. Model strings like "openai:gpt-5.5" are what the docs use in agent examples.
  2. Reach for the provider class when you need provider-only parameters (for example ChatOpenAI's useresponsesapi, which picks the Responses vs Completions API).
  3. For OpenAI-compatible endpoints (Together, vLLM), pass model_provider="openai" with a base_url. For routers like OpenRouter or LiteLLM, use the dedicated integrations instead: ChatOpenRouter from langchain-openrouter, or ChatLiteLLM / ChatLiteLLMRouter from langchain-litellm.

When to use this

  • This covers exactly what the title says: initchatmodel and model strings.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with initchatmodel; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Mentions 5.5 in the original; behavior may differ on much older or newer releases.

Evidence

Verified against the official LangChain docs on 2026-09-26. Models: https://docs.langchain.com/oss/python/langchain/models ; quickstart: https://docs.langchain.com/oss/python/langchain/quickstart

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_6RoOnxzHAX_ZzDd3L9W4Gg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">init_chat_model and model strings: the current way to pick a model <span>— Vectle</span></a>