DEV Community

Ibrahim |
Ibrahim |

Posted on

Using Goose with OpenAI

In this post, we’ll learn how to set up an OpenAI account and obtain API keys to use with Goose AI.


What is Goose?

Goose is your all-in-one on-demand tool. It helps developers by allowing them to assign tasks to Goose, which completes them swiftly and efficiently.


How to Install Goose

To install Goose, use pipx. First, ensure pipx is installed by running the following commands:

brew install pipx
pipx ensurepath
Enter fullscreen mode Exit fullscreen mode

How to Obtain Your API Key from OpenAI

To access your OpenAI API key, follow these steps:

  1. Navigate to the OpenAI API Keys page.
  2. Sign up or log in to your OpenAI account on the website.

OpenAI Signup/Login Page

  1. Once logged in, you will be redirected to the API key management page. Click on "Create new secret key" to generate your API key.

OpenAI API Key Creation

  1. Copy and securely store your API key, as it will only be shown once. Use this key to integrate OpenAI with your applications.

Adding Credits for API Usage

To interact with the Goose terminal, you need to have credits available in your OpenAI account. Follow the steps below to add credits:

  1. Click on Settings at the top-right corner of the OpenAI platform, then select Billing.

Settings and Billing

  1. Under the Billing section, click on Add Payment Method to enter your payment details.

Add Payment Method

  1. Once your payment method is successfully added, you will be prompted to purchase credits for API usage. The minimum purchase amount is $5. Complete the purchase to activate your API for use with Goose AI.

After adding credits, you are ready to leverage Goose AI for your tasks.

Using OpenAI as the Provider in Goose

After obtaining your API credits and API key, follow these steps to configure Goose with OpenAI as the provider:

  1. Open your terminal and start a Goose session by typing:
   goose session start
Enter fullscreen mode Exit fullscreen mode
  1. When prompted, enter the OpenAI API key you copied earlier and press Enter.

  2. Confirm by typing y to save your API key for future sessions.

  3. Once the setup is complete, you can begin writing prompts in the terminal to interact with Goose AI.

Writing Simple Prompts

Once your terminal session is active, you can assign tasks to your AI agents, such as automating coding tasks or completing existing code. Let's generate a simple prompt using the terminal.

Terminal Example

For example, we can ask Goose to create a simple calculator project using Vite with Vue as the framework.

Type the following instruction in the terminal:

Create a calculator in vite using vue as the framework
Enter fullscreen mode Exit fullscreen mode

Image description

As shown above, Goose successfully created a folder named calculator and initialized the project. Next, we can open the project in VS Code by instructing Goose to open the folder in the editor.

open the directory in vscode you just created
Enter fullscreen mode Exit fullscreen mode

Voila it opens vscode

Image description

I believe now you get a glimpse on how to use goose ai using the openAI.

Top comments (0)