Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. go-openai

go-openai

Apache-2.0Gov1.41.2

Unofficial Go client library for the OpenAI API, supporting ChatGPT, GPT-4, DALL·E, Whisper, and more.

GitHubGitHub
10.7k stars1.7k forks0 contributors

What is go-openai?

go-openai is an unofficial Go client library that provides comprehensive access to the OpenAI API. It enables Go developers to integrate AI models like ChatGPT, GPT-4, DALL·E, and Whisper into their applications with a clean and idiomatic Go interface.

Target Audience

Go developers building applications that require integration with OpenAI's models, such as chatbots, image generators, audio transcription services, or AI-powered tools.

Value Proposition

Developers choose go-openai for its full API coverage, including streaming and Azure OpenAI compatibility, combined with a Go-idiomatic design that mirrors the official API structure while offering robust error handling and configuration options.

Overview

OpenAI ChatGPT, GPT-5, GPT-Image-1, Whisper API clients for Go

Use Cases

Best For

  • Building Go-based chatbots or conversational AI using ChatGPT and GPT-4 models with streaming support.
  • Integrating image generation capabilities from DALL·E 2, DALL·E 3, or GPT Image 1 into Go applications.
  • Adding audio transcription and captioning features via the Whisper model in Go services.
  • Developing applications that require structured outputs or JSON schema for function calling with OpenAI models.
  • Creating and managing fine-tuned models using OpenAI's fine-tuning API within a Go environment.
  • Implementing Azure OpenAI service integrations in Go projects with seamless configuration.

Not Ideal For

  • Projects requiring deterministic AI responses with temperature=0, due to the library's omitempty bug that sends default values instead.
  • Applications needing built-in token counting for cost tracking or request optimization, as the library explicitly states no plans to add this feature.
  • Teams that prioritize official vendor support and guaranteed API compatibility over community-maintained libraries.
  • Environments where minimal external dependencies are critical, as the library requires Go 1.18+ and may introduce integration overhead.

Pros & Cons

Pros

Comprehensive Model Support

Supports all major OpenAI models including ChatGPT 4o, DALL·E 3, and Whisper, with extensive code examples in the README for each.

Streaming and Real-time Responses

Includes both chat and completion streaming, enabling real-time AI interactions as shown in the streaming examples.

Azure OpenAI Integration

Offers seamless configuration for Azure OpenAI services, with dedicated examples for Azure ChatGPT and embeddings.

Structured Outputs and JSON Schema

Facilitates function calling and structured responses using the built-in jsonschema package, detailed in the examples.

Cons

Temperature Handling Bug

A known issue where temperature=0 is omitted from requests due to Go's omitempty, leading to non-deterministic outputs, as admitted in the FAQ with workarounds required.

No Token Counting

The library lacks built-in token counting, a common need for cost management, and the README states no plans to implement it, pushing users to external solutions.

Unofficial Maintenance Risks

As an unofficial client, it may lag behind API updates or have compatibility gaps compared to official SDKs, though it aims for comprehensive coverage.

Frequently Asked Questions

Quick Stats

Stars10,725
Forks1,701
Contributors0
Open Issues158
Last commit9 months ago
CreatedSince 2020

Tags

#ai-integration#chatgpt-api#go-client#streaming-api#azure-openai#openai#gpt-4#fine-tuning#dall-e#openai-whisper#embeddings#golang#chatgpt#whisper-api#go#openai-api

Built With

G
Go

Included in

Go169.1k
Auto-fetched 5 hours ago

Related Projects

githubgithub

Go library for accessing the GitHub v3 API

Stars11,275
Forks2,428
Last commit14 hours ago
DiscordgoDiscordgo

(Golang) Go bindings for Discord

Stars5,967
Forks923
Last commit5 months ago
slackslack

Slack API in Go

Stars4,953
Forks1,193
Last commit4 days ago
google-cloudgoogle-cloud

Google Cloud Client Libraries for Go.

Stars4,483
Forks1,563
Last commit9 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub