Skip to content

OpenAI

OpenAI is the default provider for text models.

For other OpenAI-compatible services, see:

local openai_key = "sk-your-openai-key-here"

config.set {
  ai = {
    providers = {
      openai = {
        apiKey = openai_key,
        preferredModels = {"gpt-4o", "gpt-4o-mini"}
      }
    },
    -- Optional: auto-select a default model on startup
    defaultTextModel = "openai:gpt-4o"
  }
}

With this configuration:

  • Run "AI: Select Text Model" to see all available OpenAI models
  • "AI: Refresh Model List" updates the cached model list
  • preferredModels appear first in the picker (marked with ★)

Legacy Configuration

Deprecated

The textModels array configuration is deprecated. Please migrate to the providers config above.

config.set {
  ai = {
    keys = {
      OPENAI_API_KEY = "your-openai-key-here"
    },
    textModels = {
      {name = "gpt-4o", provider = "openai", modelName = "gpt-4o"},
      {name = "gpt-4o-mini", provider = "openai", modelName = "gpt-4o-mini"}
    }
  }
}

Provider Options

Option Description
apiKey Your OpenAI API key
baseUrl Custom API endpoint (default: https://api.openai.com/v1)
useProxy Use SilverBullet's proxy (default: true)
preferredModels Array of model names to show first in the picker

Cost

While this plugin is free to use, OpenAI does charge for their API usage. Please see their pricing page for cost of the various APIs.

See OpenAI's list of models for available model names.