Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/detect-breaking-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI
on:
pull_request:
branches:
- main
- next

jobs:
detect_breaking_changes:
runs-on: 'ubuntu-latest'
name: detect-breaking-changes
if: github.repository == 'openai/openai-go'
steps:
- name: Calculate fetch-depth
run: |
echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV

- uses: actions/checkout@v4
with:
# Ensure we can check out the pull request base in the script below.
fetch-depth: ${{ env.FETCH_DEPTH }}

- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Detect breaking changes
run: |
# Try to check out previous versions of the breaking change detection script. This ensures that
# we still detect breaking changes when entire files and their tests are removed.
git checkout "${{ github.event.pull_request.base.sha }}" -- ./scripts/detect-breaking-changes 2>/dev/null || true
./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.1.1"
".": "2.2.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7ef7a457c3bf05364e66e48c9ca34f31bfef1f6c9b7c15b1812346105e0abb16.yml
openapi_spec_hash: a2b1f5d8fbb62175c93b0ebea9f10063
config_hash: 76afa3236f36854a8705f1281b1990b8
configured_endpoints: 106
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-356b4364203ff36d7724074cd04f6e684253bfcc3c9d969122d730aa7bc51b46.yml
openapi_spec_hash: 4ab8e96f52699bc3d2b0c4432aa92af8
config_hash: b854932c0ea24b400bdd64e4376936bd
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 2.2.0 (2025-09-02)

Full Changelog: [v2.1.1...v2.2.0](https://github.com/openai/openai-go/compare/v2.1.1...v2.2.0)

### Features

* **api:** Add connectors support for MCP tool ([35888bc](https://github.com/openai/openai-go/commit/35888bcd26c7633e8ea68f9213cc3977b8ac49eb))
* **api:** add web search filters ([6f2c71d](https://github.com/openai/openai-go/commit/6f2c71d4e28971fc73e7e291d40f3b875d9cc42a))
* **api:** adding support for /v1/conversations to the API ([5b7c31b](https://github.com/openai/openai-go/commit/5b7c31bde9c1086d3fb71c88dfdf74228845b22e))
* **api:** realtime API updates ([130fc8e](https://github.com/openai/openai-go/commit/130fc8ea5ba39e6c1457ed6d26ef827d931a6242))
* **client:** add support for verifying signatures on incoming webhooks ([f7c8dbb](https://github.com/openai/openai-go/commit/f7c8dbb6b5bd5bab72b7d146dc255d543b0b5a71))


### Bug Fixes

* **azure:** compatibility with edit image endpoint ([#477](https://github.com/openai/openai-go/issues/477)) ([d156eec](https://github.com/openai/openai-go/commit/d156eeca37bc86a5d8e1c973063a8425744810f1))
* close body before retrying ([8dfed35](https://github.com/openai/openai-go/commit/8dfed35f11a00970ad804ab985cf393c2332ea8f))


### Chores

* **internal/ci:** setup breaking change detection ([0af0cd0](https://github.com/openai/openai-go/commit/0af0cd01302d3859a4e43554ed8e665007f69aad))
* **internal:** version bump ([3265795](https://github.com/openai/openai-go/commit/3265795fffa44fb40d65a800b300807d9f1e7b2b))

## 2.1.1 (2025-08-20)

Full Changelog: [v2.1.0...v2.1.1](https://github.com/openai/openai-go/compare/v2.1.0...v2.1.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/openai/openai-go@v2.1.1'
go get -u 'github.com/openai/openai-go/v2@v2.2.0'
```

<!-- x-release-please-end -->
Expand Down
71 changes: 71 additions & 0 deletions api.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions audiospeech.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ const (
AudioSpeechNewParamsVoiceSage AudioSpeechNewParamsVoice = "sage"
AudioSpeechNewParamsVoiceShimmer AudioSpeechNewParamsVoice = "shimmer"
AudioSpeechNewParamsVoiceVerse AudioSpeechNewParamsVoice = "verse"
AudioSpeechNewParamsVoiceMarin AudioSpeechNewParamsVoice = "marin"
AudioSpeechNewParamsVoiceCedar AudioSpeechNewParamsVoice = "cedar"
)

// The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
Expand Down
11 changes: 6 additions & 5 deletions azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,12 @@ var jsonRoutes = map[string]bool{
"/openai/images/generations": true,
}

// audioMultipartRoutes have mime/multipart payloads. These are less generic - we're very much
// multipartRoutes have mime/multipart payloads. These are less generic - we're very much
// expecting a transcription or translation payload for these.
var audioMultipartRoutes = map[string]bool{
var multipartRoutes = map[string]bool{
"/openai/audio/transcriptions": true,
"/openai/audio/translations": true,
"/openai/images/edits": true,
}

// getReplacementPathWithDeployment parses the request body to extract out the Model parameter (or equivalent)
Expand All @@ -150,8 +151,8 @@ func getReplacementPathWithDeployment(req *http.Request) (string, error) {
return getJSONRoute(req)
}

if audioMultipartRoutes[req.URL.Path] {
return getAudioMultipartRoute(req)
if multipartRoutes[req.URL.Path] {
return getMultipartRoute(req)
}

// No need to relocate the path. We've already tacked on /openai when we setup the endpoint.
Expand Down Expand Up @@ -181,7 +182,7 @@ func getJSONRoute(req *http.Request) (string, error) {
return strings.Replace(req.URL.Path, "/openai/", "/openai/deployments/"+escapedDeployment+"/", 1), nil
}

func getAudioMultipartRoute(req *http.Request) (string, error) {
func getMultipartRoute(req *http.Request) (string, error) {
// body is a multipart/mime body type instead.
mimeBytes, err := io.ReadAll(req.Body)

Expand Down
2 changes: 2 additions & 0 deletions betathreadmessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@ func (r *Message) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

func (Message) ImplConversationItemUnion() {}

type MessageAttachment struct {
// The ID of the file to attach to the message.
FileID string `json:"file_id"`
Expand Down
2 changes: 2 additions & 0 deletions chatcompletion.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ const (
ChatCompletionAudioParamVoiceSage ChatCompletionAudioParamVoice = "sage"
ChatCompletionAudioParamVoiceShimmer ChatCompletionAudioParamVoice = "shimmer"
ChatCompletionAudioParamVoiceVerse ChatCompletionAudioParamVoice = "verse"
ChatCompletionAudioParamVoiceMarin ChatCompletionAudioParamVoice = "marin"
ChatCompletionAudioParamVoiceCedar ChatCompletionAudioParamVoice = "cedar"
)

// Represents a streamed chunk of a chat completion response returned by the model,
Expand Down
42 changes: 24 additions & 18 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import (
"net/http"
"os"

"github.com/openai/openai-go/v2/conversations"
"github.com/openai/openai-go/v2/internal/requestconfig"
"github.com/openai/openai-go/v2/option"
"github.com/openai/openai-go/v2/realtime"
"github.com/openai/openai-go/v2/responses"
"github.com/openai/openai-go/v2/webhooks"
)
Expand All @@ -17,24 +19,26 @@ import (
// interacting with the openai API. You should not instantiate this client
// directly, and instead use the [NewClient] method instead.
type Client struct {
Options []option.RequestOption
Completions CompletionService
Chat ChatService
Embeddings EmbeddingService
Files FileService
Images ImageService
Audio AudioService
Moderations ModerationService
Models ModelService
FineTuning FineTuningService
Graders GraderService
VectorStores VectorStoreService
Webhooks webhooks.WebhookService
Beta BetaService
Batches BatchService
Uploads UploadService
Responses responses.ResponseService
Containers ContainerService
Options []option.RequestOption
Completions CompletionService
Chat ChatService
Embeddings EmbeddingService
Files FileService
Images ImageService
Audio AudioService
Moderations ModerationService
Models ModelService
FineTuning FineTuningService
Graders GraderService
VectorStores VectorStoreService
Webhooks webhooks.WebhookService
Beta BetaService
Batches BatchService
Uploads UploadService
Responses responses.ResponseService
Realtime realtime.RealtimeService
Conversations conversations.ConversationService
Containers ContainerService
}

// DefaultClientOptions read from the environment (OPENAI_API_KEY, OPENAI_ORG_ID,
Expand Down Expand Up @@ -86,6 +90,8 @@ func NewClient(opts ...option.RequestOption) (r Client) {
r.Batches = NewBatchService(opts...)
r.Uploads = NewUploadService(opts...)
r.Responses = responses.NewResponseService(opts...)
r.Realtime = realtime.NewRealtimeService(opts...)
r.Conversations = conversations.NewConversationService(opts...)
r.Containers = NewContainerService(opts...)

return
Expand Down
Loading
Loading