Skip to main content
Try the new W&B Inference service free. It gives you access to AI models through an API and the Weave Playground.
Follow these steps to track your first call. You can also Open In Colab

1. Install Weave and get your API key

Install weave First, install the weave library:
Get your API key Create a W&B account at https://wandb.ai. Then copy your API key from https://wandb.ai/authorize.

2. Log a trace to a new project

Follow these steps to track your first project:
  • Import the weave library
  • Call weave.init('project-name') to start tracking
    • The system asks for your API key if you haven’t logged in yet
    • To log to a team, use team-name/project-name
    • Set the WANDB_API_KEY environment variable to skip the login prompt
  • Add @weave.op() to the functions you want to track
This example uses OpenAI. You need an OpenAI API key.
When you call extract_dinos, Weave shows a link to view your trace.

3. Automatic AI library logging

Weave tracks calls to many AI services: Weave logs:
  • AI model info
  • Token usage
  • Cost
To track other AI tools, wrap them with @weave.op().

4. See traces in your project

Great job. Now Weave captures data every time you call your function. It also tracks code changes. Weave Trace Outputs 1

Next steps