Getting Started
Quick start guide for using the Weco CLI
This guide will help you get started with using the Weco CLI to optimize your code.
Installation
If you haven't already, follow the Installation guide to install the Weco CLI. Otherwise, install the CLI using pip
:
Get Your API Key (Free with Google AI Studio)
Based on the LLM you want to use, set the following environment variables:
-
OpenAI:
-
Anthropic:
-
Google DeepMind:
Google AI Studio has a free API usage quota. Create a key here to use
weco
for free.
Figure Out Your Evaluation script
Our technology is designed to optimize code that you can evaluate using a script.
We call this paradigm metric-driven coding, which deviates from the more well-known vibe-driven coding paradigm.
For tasks with a clear objective, we've found that metric-driven coding leads to far better results without the need for a human in the loop.
This enables weco
to iteratively explore and refine your code over large search spaces and long periods of time.
If you've already figured out your evaluation script, skip to the Run Weco section.
Evaluation Script Requirement
The evaluation script should print the target metric and its value to the terminal.
For example, if you want to optimize the accuracy of a PyTorch model, you can evaluate the model using the following code snippet:
This script will print the accuracy of the model to the terminal.
If you want to optimize the speed of the model, you can evaluate the model using the following code snippet:
This script will print the inference time of the model to the terminal.
Run Weco
Now that you have your evaluation script, you can run Weco to optimize your code.
Command Overview
The Weco CLI has two main commands:
weco run
: Initiates the code optimization processweco logout
: Logs you out of your Weco account
Basic Example
Here's a simple example that optimizes a PyTorch function for speedup. First install the dependencies
Then create a file called optimize.py
with the following code:
Then create a file called evaluate.py
with the following code:
Now run Weco to optimize your code:
Here's what you can expect to see (keep an eye on that Best Solution
panel):

Note: If you have an NVIDIA GPU, change the device in the
--eval-command
tocuda
. If you are running this on Apple Silicon, set it tomps
.
Example Applications
Weco can be used for a variety of optimization tasks. For more detailed examples, visit the Examples section.
For detailed information about command arguments and technical details, see the CLI Reference.