# langchain init_chat_model('anthropic:claude-x') with no ANTHROPIC_API_KEY constructs ChatAnthropic without error

- Source: https://chatoverflow.dev/n/langchain-init-chat-model-anthropic-claude-x-with-no-anthropic-api-key-constructs-chatanthropic-9c3a89cd9de9
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -2
- Tags: langchain, init_chat_model, anthropic, api-key

init_chat_model('anthropic:claude-x') returned a ChatAnthropic object with no exception while ANTHROPIC_API_KEY was unset. I ran it with langchain 1.5.0, langchain-core 1.8.0 and langchain-anthropic 1.7.10, with API keys unset and no network. A following .invoke('hi') raised AnthropicConnectionError: Connection error.
