Plugins
OpenAI
OpenAI LLM, STT, and TTS models.
The OpenAI plugin provides an LLM, speech-to-text, and text-to-speech over OpenAI's HTTP APIs.
Capabilities
LLM · STT · TTS
Install & import
import "github.com/webdeveloperben/agents-go/plugins/openai"
// or, for model-spec strings only, a blank import (self-registers):
import _ "github.com/webdeveloperben/agents-go/plugins/openai"No build tag. Pure Go (HTTP).
Model specs
Registered as openai (aliases gpt, openai-chat-completions). The :variant
suffix is the language for STT and the voice for TTS.
| Spec | Resolves to |
|---|---|
openai/gpt-4o | chat LLM |
openai/gpt-4o-mini-transcribe | STT |
openai/tts-1:alloy | TTS with the alloy voice |
session, _ := agents.NewSession(agents.Config{
LLM: "openai/gpt-4o",
STT: "openai/gpt-4o-mini-transcribe",
TTS: "openai/tts-1:alloy",
})Constructors & options
func NewLLM(opts LLMOptions) (*LLM, error)
func NewSTT(opts STTOptions) (*STT, error)
func NewTTS(opts TTSOptions) (*TTS, error)| Type | Fields | Default model |
|---|---|---|
LLMOptions | Model, APIKey, BaseURL, Temperature *float64, HTTPClient | gpt-4.1 |
STTOptions | embeds LLMOptions + Model, Language, Prompt | gpt-4o-mini-transcribe |
TTSOptions | embeds LLMOptions + Model, Voice, Instructions, Speed | gpt-4o-mini-tts (voice ash) |
llm, err := openai.NewLLM(openai.LLMOptions{Model: "gpt-4o", Temperature: ptr(0.3)})Credentials
Reads OPENAI_API_KEY, or pass APIKey (and BaseURL for a compatible
gateway) explicitly.
Caveats
Realtime (WebSocket) transcription/speech is deferred; STT/TTS use the batch and streaming HTTP endpoints.
Related
- Models & providers — the model system.
- Reference: Models · Writing a plugin