-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Using the Pythagora VS Code extension with your own API key
Note: This is only applicable to users who want to use Pythagora with their own API key. Pythagora Pro users do not need to follow the steps below, as no API key is required for Pro users.
To setup the Pythagora VS Code extension using your own API key:
1 - Via the command line, clone the GPT Pilot repo using the command: git clone https://github.com/Pythagora-io/gpt-pilot.git
2 - Inside the parent directory where GPT Pilot was cloned, go to GPT Pilot's directory: cd gpt-pilot
3 - Create a virtual environment: python3 -m venv venv
4 - Activate the virtual environment: source venv/bin/activate
. For Windows users: venv\Scripts\activate
5 - Install the dependencies: pip install -r requirements.txt
6 - Copy the example-config.json
file to create a config.json
file: cp example-config.json config.json
7 - Edit the new config.json
file to include the LLM you want to use and remove the other LLMs that you won't use. Then, add your own API keys, etc:
For OpenAI, the llm
section of the config.json
file should have:
"llm": {
"openai": {
"base_url": "https://api.openai.com/v1/",
"api_key": "sk-your-api-key",
For Anthropic:
"llm": {
"anthropic": {
"base_url": "https://api.anthropic.com/",
"api_key": "sk-your-api-key",
8 - Update the all of the agents in the agent
section of the config.json
file so the provider
and model
properties contain the correct LLM and model. An example using Anthropic:
"agent": {
"default": {
"provider": "anthropic",
"model": "claude-3-5-sonnet-20240620",
"temperature": 0.5
},
Note: Double-check the LLM's official documentation to ensure you have the correct model number. Click here for the OpenAI documentation. Go here for Anthropic's docs.
The Integrations Guides section has additional config examples for local LLM's, etc.
9 - Inside of VS Code, go to the Pythagora extension's settings page by clicking on the gear icon. Make sure the GPT Pilot path
is pointing to the directory containing the cloned repo:
For example, if your parent directory is called projects
and you clone GPT Pilot inside of projects
, the projects
directory will contain a subdirectory called gpt-pilot
. In settings, the GPT Pilot path
section will need to be changed to the projects
directory.
10 - That's it! Pythagora's settings page should show that you're using your own API key (e.g. You're using your own Anthropic key.
). If the settings page still says You are out of credit
, you may need to restart VS Code for the changes to be reflected on the settings page.