Skip to content

Guide · Open source

How to use claude-cookbooks: setup, recipes and tips

Updated · written with AI from the project's own documentation and checked against our catalogue data

claude-cookbooks is an open-source collection of Jupyter notebooks and guides with copy-able code showing how to build with Claude, Anthropic's AI model, through its API. It is aimed at developers, mainly Python developers, who want working examples to start from. By the end of this guide you will know what you need installed, how to get the repository, and where to find recipes for tasks such as tool use, retrieval augmented generation and vision.

Claude Cookbooksanthropics/claude-cookbooks · ★ 54.1k · MIT

Quick start

  1. 1Get a Claude API key. Sign up for a Claude API key at anthropic.com, as the README describes.
  2. 2Install Python. The examples are primarily written in Python, so set up a working Python environment.
  3. 3Install Jupyter. Install Jupyter Notebook or JupyterLab so you can open the .ipynb files.
  4. 4Clone the repository. Run git clone https://github.com/anthropics/claude-cookbooks in your terminal.
  5. 5Open a recipe. Pick a notebook from the table of recipes that matches your task, such as tool use or vision, and open it in Jupyter.
  6. 6Run the cells with your key. Add your Claude API key and run the cells, then copy the parts you need into your own project.

What you need before you start

The examples assume you have a Claude API key. The README says you can sign up for one free at anthropic.com. The code is primarily written in Python, so Python is the expected language.

You will also need Jupyter Notebook or JupyterLab to open and run the .ipynb files. If you are new to the Claude API, the README recommends starting with the Claude API Fundamentals course in the anthropics/courses repository first.

  • Python
  • A Claude API key
  • Jupyter Notebook or JupyterLab

Get the repository on your computer

The project is set up as clone-and-build. Clone the repository with git, then open the folder it creates.

git clone https://github.com/anthropics/claude-cookbooks

Find the recipe that matches your task

The README groups recipes into sections. Capabilities covers classification, retrieval augmented generation and summarization. Tool Use and Integration covers a customer service agent, a calculator integration and SQL queries. Third-Party Integrations covers RAG with Pinecone, Wikipedia and web pages, plus embeddings with Voyage AI. Multimodal Capabilities covers vision, including images, best practices, charts and graphs, and form extraction. Advanced Techniques covers sub-agents, PDF upload, automated evaluations, JSON mode, a moderation filter, prompt caching and cost optimization.

  • Classification and summarization: text and data tasks
  • Tool use: connect Claude to external tools and functions
  • Retrieval augmented generation: add external knowledge, from vector databases or Wikipedia
  • Vision: send images and read charts or forms
  • Advanced: prompt caching, JSON mode, automated evals

Run a notebook and adapt the code

Open a notebook in Jupyter, read the explanation around the code, and run the cells with your API key. The recipes are meant to be copied, so the usual workflow is to lift the snippets that fit your task into your own project and change them to match your data and prompts.

The README notes that the concepts can be adapted to any language that supports the Claude API, but the examples themselves are Python. Expect to translate the code yourself if you use another language.

Contribute or find more resources

Contributions are welcome, including ideas, typo fixes, new guides and improvements to existing ones. The README asks contributors to check existing issues and pull requests first to avoid duplicate work. Ideas for new examples go on the issues page of the anthropic-cookbook repository.

The README also links to Anthropic's developer documentation, support docs and Discord community, plus Anthropic on AWS and AWS Samples for using Claude on AWS infrastructure.

What people use it for

  • Building a customer service agent that uses tools, using the tool use customer service example
  • Adding a calculator tool so Claude can call external functions
  • Answering questions over your own documents with retrieval augmented generation, for example with Pinecone
  • Extracting content from forms or reading charts and graphs with the vision recipes
  • Summarizing PDFs by parsing them to text and passing them to Claude

Frequently asked questions

Is claude-cookbooks free to use?

The repository is released under the MIT licence, as listed on its page. The README says you can sign up for a Claude API key free, but API usage costs beyond that are not covered in the source.

What do I need to run claude-cookbooks?

You need Python, a Claude API key, and Jupyter Notebook or JupyterLab. The recipes are code notebooks, so basic coding knowledge is assumed.

Can I use claude-cookbooks without knowing Python?

The README says the code is primarily Python. Non-programmers will find the notebooks hard to follow, and other languages require you to adapt the concepts yourself.

How do I install claude-cookbooks?

Clone the repository with git clone https://github.com/anthropics/claude-cookbooks, then open the notebooks in Jupyter. There is no packaged installer in the README.

Is claude-cookbooks a finished app?

No. It is a collection of example code and guides meant to be copied into your own projects, not an end-user product.

How does claude-cookbooks compare to the OpenAI Cookbook or LangChain?

The OpenAI Cookbook offers similar example notebooks for OpenAI's models. LangChain and LlamaIndex are frameworks for building LLM applications, while claude-cookbooks focuses on direct, copy-able Claude API examples.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

claude-cookbooks suits Python developers who want working Claude API examples for tool use, retrieval augmented generation, vision or evaluations, and who plan to adapt the code. If you need a finished app, a non-Python codebase, or you have no coding background, pick a different resource such as the Anthropic courses repository for beginners or a framework like LangChain or LlamaIndex for building larger applications.

Install options & downloads