LangSmith pricing
Quick answer
LangSmith offers a free tier with limited usage for tracing and observability of AI calls. Paid plans scale based on usage volume and features, with pricing details available on the official LangSmith website. Use the LangSmith Client to integrate and monitor your AI workflows efficiently.
PREREQUISITES
Python 3.8+LangSmith API keypip install langsmith
Setup
Install the langsmith Python package and set your API key as an environment variable to start using LangSmith for AI observability.
pip install langsmith Step by step
Use the LangSmith client to initialize tracing in your AI application. The free tier allows basic tracing, while paid plans unlock advanced features and higher usage limits.
import os
from langsmith import Client, traceable
# Set your LangSmith API key in environment variable LANGSMITH_API_KEY
client = Client(api_key=os.environ["LANGSMITH_API_KEY"])
@traceable
def run_ai_task(prompt: str) -> str:
# Simulate AI call
return f"Response to: {prompt}"
result = run_ai_task("Hello LangSmith pricing")
print(result) output
Response to: Hello LangSmith pricing
Common variations
You can integrate LangSmith tracing with LangChain or other AI frameworks by setting environment variables LANGCHAIN_TRACING_V2 and LANGCHAIN_API_KEY. Async usage and custom project names are supported.
import os
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = os.environ["LANGSMITH_API_KEY"]
os.environ["LANGCHAIN_PROJECT"] = "my-project"
# Now all LangChain calls are automatically traced
from langchain_openai import ChatOpenAI
chat = ChatOpenAI(model="gpt-4o-mini")
response = chat.invoke([{"role": "user", "content": "Hello"}])
print(response.content) output
Hello
Troubleshooting
- If you see authentication errors, verify your
LANGSMITH_API_KEYenvironment variable is set correctly. - For missing traces, ensure
LANGCHAIN_TRACING_V2is enabled and your project name is set. - Check LangSmith's official pricing page for updated usage limits and plan details.
Key Takeaways
- LangSmith provides a free tier with basic tracing and paid plans for higher usage and features.
- Set environment variables to enable automatic tracing in LangChain and other frameworks.
- Always secure your API key via environment variables to avoid authentication issues.