← all repositories
sashabaranov/go-openai

An unofficial Go client that tracks every OpenAI model drop

Unofficial Go bindings that keep pace with OpenAI's full API surface, from chat to images to speech.

go-openai
Not currently ranked — collecting fresh signals.
star history

What it does Provides unofficial Go clients for the OpenAI API, wrapping endpoints for chat completions (GPT-3, GPT-4, 4o, o1), image generation (DALL·E 2, DALL·E 3, GPT Image 1), speech-to-text (Whisper), and embeddings into typed structs. It handles the HTTP boilerplate so you don’t have to hand-roll JSON.

The interesting bit It also speaks Azure OpenAI, letting you swap endpoints and deployment names via a configurable model mapper. That dual-vendor support is unusual for an unofficial client, suggesting the maintainer cares about production portability rather than just weekend demos.

Key highlights

  • Covers chat, images, audio, and embeddings in one dependency
  • Supports streaming completions for real-time token delivery
  • Azure OpenAI compatible, with custom model-to-deployment mapping
  • Allows custom HTTP clients and proxy configuration
  • Requires Go 1.18 or newer

Caveats

  • Explicitly unofficial: breaking API changes depend on community turnaround
  • Documentation is example-heavy and omits guidance on retries, rate limits, or production error handling

Verdict A practical pick for Go services that need typed access to OpenAI’s generative APIs without maintaining their own HTTP client. Skip it if you require an officially supported SDK or built-in resilience patterns.

Frequently asked

What is sashabaranov/go-openai?
Unofficial Go bindings that keep pace with OpenAI's full API surface, from chat to images to speech.
Is go-openai open source?
Yes — sashabaranov/go-openai is open source, released under the Apache-2.0 license.
What language is go-openai written in?
sashabaranov/go-openai is primarily written in Go.
How popular is go-openai?
sashabaranov/go-openai has 10.7k stars on GitHub.
Where can I find go-openai?
sashabaranov/go-openai is on GitHub at https://github.com/sashabaranov/go-openai.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.