openai-go is the official Go library for accessing the OpenAI API.
The library provides convenient access to OpenAI's REST API from Go applications, handling the details of HTTP communication, request formatting, and response parsing. It supports the Responses API as the primary interface for interacting with OpenAI models, enabling text generation, multi-turn conversations, streaming responses, tool calling, and structured outputs. The library also includes WebSocket support for persistent Responses connections, with configurable message size limits, buffer management, and connection recovery mechanisms.
Developers building Go applications that need to integrate OpenAI's models should use this library. It suits projects ranging from simple text generation tasks to complex multi-turn conversational systems with tool use and structured outputs. The library requires Go 1.25 or later for recent versions, though earlier SDK releases remain available for applications on older Go versions.
The project maintains active development with regular updates to align with OpenAI API changes. The maintainers document breaking changes in the changelog and provide clear upgrade guidance through a versioned Go compatibility policy. Examples covering streaming, structured outputs, and WebSocket connections are included in the repository to guide integration patterns.