PyPI
pypi.org › project › anthropic
anthropic · PyPI
import json import rich from typing_extensions import Literal from anthropic import Anthropic, beta_tool client = Anthropic() @beta_tool def get_weather(location: str) -> str: """Lookup the weather for a given city in either celsius or fahrenheit Args: location: The city and state, e.g.
» pip install anthropic
GitHub
github.com › anthropics › anthropic-sdk-python
GitHub - anthropics/anthropic-sdk-python
import json import rich from typing_extensions import Literal from anthropic import Anthropic, beta_tool client = Anthropic() @beta_tool def get_weather(location: str) -> str: """Lookup the weather for a given city in either celsius or fahrenheit Args: location: The city and state, e.g.
Starred by 2.5K users
Forked by 410 users
Languages Python
Videos
GitHub
github.com › anthropics › anthropic-sdk-typescript
GitHub - anthropics/anthropic-sdk-typescript: Access to Anthropic's safety-first language model APIs in TypeScript
... The full API of this library can be found in api.md. import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic({ apiKey: process.env['ANTHROPIC_API_KEY'], // This is the default and can be omitted }); const message = await ...
Starred by 1.4K users
Forked by 181 users
Languages TypeScript 96.8% | Shell 2.1% | JavaScript 1.1%
Anthropic
docs.anthropic.com › claude › reference › getting-started-with-the-api
API Overview - Claude Docs
from anthropic import Anthropic client = Anthropic() # Reads ANTHROPIC_API_KEY from environment message = client.messages.create( model="claude-sonnet-4-5", max_tokens=1024, messages=[{"role": "user", "content": "Hello, Claude"}] )
LangChain
python.langchain.com › docs › integrations › providers › anthropic
Anthropic | 🦜️🔗 LangChain
from langchain_anthropic import ChatAnthropic model = ChatAnthropic(model='claude-3-opus-20240229')
npm
npmjs.com › package › @anthropic-ai › sdk
anthropic-ai/sdk
Be aware that doing so may result in incorrect types and other unexpected or undefined behavior in the SDK. import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic(); const message = await client.messages.create( { max_tokens: ...
» npm install @anthropic-ai/sdk
Published Dec 06, 2025
Version 0.71.2
Author Anthropic
LlamaIndex
docs.llamaindex.ai › en › stable › examples › llm › anthropic
Anthropic - LlamaIndex
Anthropic supports direct tool/function calling through the API. Using LlamaIndex, we can implement some core agentic tool calling patterns. ... from llama_index.core.tools import FunctionTool from llama_index.core.llms import ChatMessage from llama_index.llms.anthropic import Anthropic from datetime import datetime llm = Anthropic(model="claude-sonnet-4-0") def get_current_time() -> dict: """Get the current time""" return {"time": datetime.now().strftime("%Y-%m-%d %H:%M:%S")} # uses the tool name, any type annotations, and docstring to describe the tool tool = FunctionTool.from_defaults(fn=get_current_time)
LangChain
api.python.langchain.com › en › latest › llms › langchain_community.llms.anthropic.Anthropic.html
langchain_community.llms.anthropic.Anthropic — 🦜🔗 LangChain 0.2.17
To use, you should have the anthropic python package installed, and the environment variable ANTHROPIC_API_KEY set with your API key, or pass it as a named parameter to the constructor. ... import anthropic from langchain_community.llms import Anthropic model = Anthropic(model="<model_name>", ...
npm
npmjs.com › package › @ai-sdk › anthropic
@ai-sdk/anthropic - npm
npm i @ai-sdk/anthropic · You can import the default provider instance anthropic from @ai-sdk/anthropic: import { anthropic } from '@ai-sdk/anthropic'; import { anthropic } from '@ai-sdk/anthropic'; import { generateText } from 'ai'; const ...
» npm install @ai-sdk/anthropic
Published Sep 14, 2025
Version 2.0.17
Repository https://github.com/vercel/ai
Homepage https://ai-sdk.dev/docs
Instructor
python.useinstructor.com › integrations › anthropic
Anthropic Claude Tutorial: Structured Outputs with Instructor - Instructor
Instructor makes it easy to analyse and extract semantic information from PDFs using Anthropic's Claude line of models. Let's see an example below with the sample PDF above where we'll load it in using our from_url method. Note that we support local files and base64 strings too with the from_path and the from_base64 class methods. from instructor.processing.multimodal import PDF from pydantic import BaseModel, Field import instructor from anthropic import Anthropic class Receipt(BaseModel): total: int items: list[str] client = instructor.from_provider("anthropic/claude-3-5-haiku-latest") url =
GitHub
github.com › geekan › MetaGPT › issues › 131
ImportError: cannot import name 'Anthropic' from 'anthropic' · ...
August 6, 2023 - Traceback (most recent call last): File "C:\metagpt\startup.py", line 7, in from metagpt.roles import Architect, Engineer, ProductManager, ProjectManager, QaEngineer File "C:\metagpt\metagpt\roles_init_.py", line 9, in from metagpt.roles.role import Role File "C:\metagpt\metagpt\roles\role.py", line 16, in from metagpt.actions import Action, ActionOutput File "C:\metagpt\metagpt\actions_init_.py", line 10, in from metagpt.actions.action import Action File "C:\metagpt\metagpt\actions\action.py", line 14, in from metagpt.llm import LLM File "C:\metagpt\metagpt\llm.py", line 9, in from metagpt.provider.anthropic_api import Claude2 as Claude File "C:\metagpt\metagpt\provider\anthropic_api.py", line 10, in from anthropic import Anthropic ImportError: cannot import name 'Anthropic' from 'anthropic' No one assigned ·
Published Aug 06, 2023