Installing CrewAI and API keys

CrewAI · Essentials · 8 min

A clean install with the right extras and keys avoids most first-run errors.

CrewAI needs Python 3.10 to 3.13. There are two common ways to install it.

As a library inside a project's virtual environment, when you just want to write Python:

pip install crewai

As a command-line tool for creating and running CrewAI projects. The docs use uv, a fast Python package and project manager:

uv tool install crewai
crewai version

uv tool install puts the crewai command on your PATH (the list of folders your shell searches for programs) without touching other projects. Upgrade later with uv tool install crewai --upgrade.

Extras are optional add-ons you request in square brackets:

  • crewai[tools] adds the crewai-tools package with ready-made tools such as web search and file reading.
  • Provider extras such as crewai[anthropic], crewai[google-genai] or crewai[bedrock] add native support for those model providers. OpenAI support is included.
  • crewai[litellm] adds LiteLLM, a library that connects to many other providers.

Agents need an LLM, so you need an API key for a provider. Put keys in a .env file in the project folder (a plain text file of NAME=value lines that CrewAI loads automatically) rather than in code. You can also set MODEL there to choose the default model in provider/model form.

Never commit .env to Git. Generated projects already list it in .gitignore.

Example

# Terminal
pip install "crewai[tools]"          # library + ready-made tools
uv tool install crewai               # or: the crewai command-line tool
crewai version                       # e.g. crewai version: 1.15.x

# .env  (in the project folder, never committed)
OPENAI_API_KEY=sk-...
MODEL=openai/gpt-4o-mini
SERPER_API_KEY=...                   # only if you use the web search tool

Remember

  • Python 3.10-3.13; pip for library use, uv tool install crewai for the CLI
  • Extras like [tools], [anthropic], [litellm] add optional features
  • Keep keys and the default MODEL in .env, never in code or Git

Watch out for

  • Installing on Python 3.14 or newer, which current releases do not support yet.

Check yourself

  1. Your agents should use Claude models through CrewAI's native integration. What should you install?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.crewai.com/en/installation