Skip to content

Guide · Open source

How to use llama-cookbook: setup, examples and tips

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

llama-cookbook is an open-source repository from Meta with example Jupyter notebooks and guides for building with the Llama model family. It covers running models (inference), fine-tuning on your own data, retrieval-augmented generation (RAG) and complete sample projects. This guide shows you how to get the repository, where to find each kind of example, and what to expect before you start.

Llama Cookbookmeta-llama/llama-cookbook · ★ 18.6k · MIT

Quick start

  1. 1Install Python and Jupyter Notebook. Make sure Python and Jupyter Notebook are installed on your computer before you begin.
  2. 2Clone the repository. Run git clone https://github.com/meta-llama/llama-cookbook to download the examples.
  3. 3Choose a folder. Pick getting-started for inference, fine-tuning or RAG, or end-to-end-use-cases for full projects.
  4. 4Open a notebook. Launch Jupyter Notebook and open the .ipynb file that matches your goal, such as build_with_llama_api.ipynb.
  5. 5Read the project README. For end-to-end projects, read the README in that folder for its specific setup.
  6. 6Check licences before use. Review the Llama model licence and Acceptable Use Policy for the model version you plan to use.

What you need before you start

llama-cookbook is a set of Python code in Jupyter Notebook format, so you need Python and Jupyter Notebook installed. The repository is not a finished app, so you will run the examples yourself.

It is a good fit if you can write and run Python code. If you are not a programmer, the examples will be hard to follow.

  • Python
  • Jupyter Notebook
  • Git, to clone the repository

Get the llama-cookbook code

The README uses a clone-and-build approach. Clone the repository with Git, then open the folder you need.

Use the cloned repository as your working copy. The examples are organised into folders, described below.

git clone https://github.com/meta-llama/llama-cookbook

Find the right folder for your goal

The repository is split into four main areas. Pick the one that matches what you want to do.

  • getting-started/: reference examples for inference, fine-tuning and RAG
  • 3p-integrations/: getting-started recipes and end-to-end use cases from various Llama providers
  • end-to-end-use-cases/: complete sample projects spanning different domains and applications
  • src/: source for the original llama-recipes library, plus FAQs for fine-tuning

Run inference with Llama models

Inference means running a model to get output. The inference examples live under getting-started/inference/. The README's latest Llama 4 recipes include a notebook called build_with_llama_api.ipynb for getting started with the Llama API, and build_with_llama_4.ipynb, which shows a 5M long context example using Llama 4 Scout.

The Llama API is a hosted service. The README links to a waitlist and documentation for it, so check those pages for access details.

  • Open getting-started/build_with_llama_api.ipynb to start with the Llama API
  • Open getting-started/build_with_llama_4.ipynb for the Llama 4 Scout long-context example

Fine-tune a model on your own data

Fine-tuning means adapting a model to your data. The fine-tuning examples are in getting-started/finetuning. The repository also has a Fine-Tuning FAQ in src/docs/ that answers common questions.

Read the FAQ before you start, since fine-tuning involves more setup than running inference.

  • Examples: getting-started/finetuning
  • Questions: src/docs/ (Fine-Tuning FAQ)

Explore end-to-end projects and provider examples

The end-to-end-use-cases folder holds complete projects. The README lists a WhatsApp bot that uses the Llama API, a research paper analyzer built with Llama 4 Maverick, and a book character mind map example. Each project has its own README with details.

The 3p-integrations folder collects recipes from different hosting providers. This is useful if you want to compare how Llama is used across services.

  • WhatsApp bot: end-to-end-use-cases/whatsapp_llama_4_bot/README.md
  • Research paper analyzer: end-to-end-use-cases/research_paper_analyzer/README.md
  • Book character mind map: end-to-end-use-cases/book-character-mindmap/README.md

Check licence terms and repository changes

The repository code is released under the MIT licence. The Llama models themselves have their own licence and Acceptable Use Policy, which the README links for each model version. Read those before you use a model in a product.

The README notes a recent refactor. If links or folders are missing, the archive-main branch is a snapshot from before the refactor. Also note that the README says the latest release is v0.0.5, and that this repository is a set of examples rather than a stable library API.

  • Repository licence: MIT
  • Model licences and Acceptable Use Policies: linked per Llama version in the README
  • Older layout: archive-main branch
git clone -b archive-main https://github.com/meta-llama/llama-cookbook

What people use it for

  • Running a Llama 4 example through the Llama API using a starter notebook
  • Building a WhatsApp bot that uses the Llama API, following the included end-to-end project
  • Analyzing research papers with Llama 4 Maverick using the paper analyzer example
  • Fine-tuning a Llama model on your own data using the fine-tuning examples
  • Comparing how Llama is accessed through different hosting providers in the 3p-integrations folder

Frequently asked questions

Is llama-cookbook free to use?

The repository is released under the MIT licence, as listed in its metadata. The Llama models have separate licence and Acceptable Use Policy terms, which the README links for each version, so check those before using a model.

What do I need to run llama-cookbook?

The source lists Python and Jupyter Notebook as prerequisites. You also need Git to clone the repository. The material is code-based, so it is aimed at developers.

What happened to llama-recipes?

According to the README, llama-recipes was renamed to llama-cookbook. The src folder contains the source for the original llama-recipes library.

Why are some folders or links missing?

The README says the repo was recently refactored. The archive-main branch is a snapshot from before the refactor, so you can use it if older links or folders are missing.

Is llama-cookbook a finished app I can use directly?

No. The README describes it as a set of examples and guides, not a product. Expect to run notebooks and adapt code to your own needs.

How does llama-cookbook compare to llama-recipes, Hugging Face Transformers examples or the LangChain cookbook?

llama-cookbook is Meta's guide for building with Llama models, with inference, fine-tuning, RAG and end-to-end examples. llama-recipes is the original library it was renamed from. Hugging Face Transformers examples and the LangChain cookbook are alternatives that focus on those frameworks rather than Llama specifically.

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

Use llama-cookbook if you are a developer who wants working Jupyter notebook examples for running, fine-tuning or building with Llama models. Pick something else if you want a finished app, a stable library API, or you are not comfortable with Python, since the repo is a set of examples that has recently been refactored.

Install options & downloads