{"id":27108,"library":"langchain-together","title":"LangChain Together","description":"An integration package connecting Together AI's API with LangChain. Provides chat models and embeddings. Current version 0.4.0, requires Python >=3.10, <4.0. Release cadence is irregular; latest releases include security patches and MCP server features.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/langchain-ai/langchain-together","tags":["langchain","together-ai","llm","integration","chat","embeddings"],"install":[{"cmd":"pip install langchain-together","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for base classes like BaseChatModel and embeddings interface.","package":"langchain-core","optional":false},{"reason":"Official Together AI Python SDK, needed for API calls.","package":"together","optional":false}],"imports":[{"note":"Incorrect: ChatTogether is exposed at the top-level package.","wrong":"from langchain_together.chat import ChatTogether","symbol":"ChatTogether","correct":"from langchain_together import ChatTogether"},{"note":"Incorrect: embeddings are also at top-level.","wrong":"from langchain_together.embeddings import TogetherEmbeddings","symbol":"TogetherEmbeddings","correct":"from langchain_together import TogetherEmbeddings"}],"quickstart":{"code":"import os\nfrom langchain_together import ChatTogether\n\nchat = ChatTogether(\n    together_api_key=os.environ.get(\"TOGETHER_API_KEY\", \"\"),\n    model=\"mistralai/Mixtral-8x7B-Instruct-v0.1\"\n)\n\nresponse = chat.invoke(\"Hello, how are you?\")\nprint(response.content)","lang":"python","description":"Basic usage: instantiate ChatTogether with API key and model, then invoke."},"warnings":[{"fix":"Change imports to the new package: from langchain_together import ChatTogether","message":"Version 0.2.0 introduced a new package structure. If you were using the old langchain_together from community, imports must be updated to 'from langchain_together import ...' instead of 'from langchain.llms import Together'","severity":"breaking","affected_versions":"<0.2.0"},{"fix":"Use the new model naming convention as documented by Together AI.","message":"The 'model' parameter used to accept model IDs like 'togethercomputer/llama-2-70b-chat'. These legacy IDs are deprecated in favor of Together AI's new model format (e.g., 'mistralai/Mixtral-8x7B-Instruct-v0.1').","severity":"deprecated","affected_versions":"<0.3.0"},{"fix":"Set the correct environment variable or pass directly via 'together_api_key' parameter.","message":"The environment variable for the API key is 'TOGETHER_API_KEY', not 'TOGETHER_AI_KEY' or 'TOGETHER_AI_API_KEY'.","severity":"gotcha","affected_versions":"all"},{"fix":"Check LangChain documentation for supported models and pass extra kwargs if needed.","message":"ChatTogether does not support all models available via Together AI's API. Some models may require additional parameters like 'temperature' or 'max_tokens' which are not passed through by default.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with 'pip install langchain-together' and import as 'from langchain_together import ChatTogether'.","cause":"Package not installed or wrong import path (e.g., from langchain.llms import Together).","error":"ModuleNotFoundError: No module named 'langchain_together'"},{"fix":"Use the correct parameter name: ChatTogether(model='mistralai/Mixtral-8x7B-Instruct-v0.1') or ChatTogether(model_kwargs={'model': '...'}) – check the latest API.","cause":"Passing the model name as a keyword argument 'model' when it should be passed as positional or via model_kwargs.","error":"InvalidRequestError: 'model' is not a valid parameter"},{"fix":"Set the TOGETHER_API_KEY environment variable or pass the key via the 'together_api_key' parameter.","cause":"API key missing or incorrect.","error":"AuthenticationError: 401 Unauthorized"},{"fix":"Upgrade to latest version: pip install --upgrade langchain-together","cause":"Using an older version of langchain-together that expected the parameter name 'api_key' instead of 'together_api_key'.","error":"TypeError: __init__() got an unexpected keyword argument 'together_api_key'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}