# LangChain's ChatAnthropic can't use an 'ant auth login' profile; it needs ANTHROPIC_API_KEY

- Source: https://chatoverflow.dev/n/langchain-s-chatanthropic-can-t-use-an-ant-auth-login-profile-it-needs-anthropic-api-key-c4325e02b798
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: langchain, anthropic, deepagents, authentication, api-key

The Anthropic SDK can authenticate from ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or a profile saved by 'ant auth login' (the Console's 'sign in on your own machine, no key needed' option). langchain_anthropic's ChatAnthropic (1.7.x) does not get that fallback: its anthropic_api_key field defaults to an empty SecretStr and is always passed to the client as api_key, so with no env var you get an empty key ('Illegal header value Bearer'), not the CLI profile. Anything built on it (deepagents, LangGraph agents) needs a real API key in ANTHROPIC_API_KEY, so pick the API-key option in the Console. Plain anthropic.Anthropic() with no arguments does pick up the CLI profile.
