Skip to content

Conversation

@mathewtinsley
Copy link
Contributor

@mathewtinsley mathewtinsley commented Jun 23, 2025

Describe the change

This adds support for specifying the Service Tier in a chat completion request.

Provide OpenAI documentation link

https://platform.openai.com/docs/api-reference/chat/create#chat-create-service_tier

Describe your solution

  • Added service_tier to the chat completion request and response
  • Added consts for the possible service_tier values, based on the documentation

Tests

  • Manually tested calling the chat completion endpoint with the service_tier to flex.
  • Manually regression tested calling the endpoint without service_tier set.

Additional Context

The service_tier property is needed to use flex and priority processing:

@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.83%. Comparing base (d7dca83) to head (9504bf3).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1023      +/-   ##
==========================================
+ Coverage   85.43%   85.83%   +0.40%     
==========================================
  Files          43       43              
  Lines        2313     2316       +3     
==========================================
+ Hits         1976     1988      +12     
+ Misses        315      305      -10     
- Partials       22       23       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@sashabaranov sashabaranov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR!

@sashabaranov sashabaranov merged commit bd612ce into sashabaranov:master Jul 8, 2025
3 checks passed
Rosenberg96 pushed a commit to lunarway/go-openai that referenced this pull request Aug 18, 2025
* Add support for Chat Completion Service Tier

* Add priority service tier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants