turbot/openai

GitHub
steampipe plugin install openaisteampipe plugin install openai

OpenAI + Steampipe

OpenAI is an Artificial Intelligence research and development company that provides APIs for general models.

Steampipe is an open source CLI to instantly query cloud APIs using SQL.

List instances in your OpenAI account:

select
completion
from
openai_completion
where
prompt = 'Write a tagline for an ice cream shop.';
+-------------------------------------------------------+
| completion |
+-------------------------------------------------------+
| 1. Cool down with a scoop of our delicious ice cream! |
| 2. Indulge your cravings with creamy goodness! |
| 3. Sweeten your day with a scoop of our tasty treats! |
+-------------------------------------------------------+

Documentation

Get started

Install

Download and install the latest OpenAI plugin:

steampipe plugin install openai

Credentials

ItemDescription
CredentialsOpenAI requires an API Key for all requests.
PermissionsAPI Keys have the same permissions as the user who creates them, and if the user permissions change, the API key permissions also change.
RadiusEach connection represents a single OpenAI Installation.
Resolution1. Credentials explicitly set in a steampipe config file (~/.steampipe/config/openai.spc)
2. Credentials specified in environment variables, e.g., OPENAI_API_KEY.

Configuration

Installing the latest openai plugin will create a config file (~/.steampipe/config/openai.spc) with a single connection named openai:

connection "openai" {
plugin = "openai"
# Get your API key at https://beta.openai.com/account/api-keys
# This can also be set via the `OPENAI_API_KEY` environment variable.
api_key = "sk-CGG8G29a47ViRhvVsCGPT8BlbkFJBvFr65mZcMJWH8fayZO8"
}

Credentials from Environment Variables

The OpenAI plugin will use the standard OpenAI environment variables to obtain credentials only if other arguments (api_key) are not specified in the connection:

export OPENAI_API_KEY=sk-CGG8G29a47ViRhvVsCGPT8BlbkFJBvFr65mZcMJWH8fayZO8

Get involved