Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support gpt-4o-audio #2032

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Laisky
Copy link
Contributor

@Laisky Laisky commented Jan 14, 2025

功能

支持 gpt-4o-audio 系列的 chat completetions

暂时没搞懂 stream 的计费模式,所以只支持了 stream==false

合并前可以使用 https://github.com/Laisky/one-api 来体验这个功能。

依赖

本提交也包含了 #2022

自测

CleanShot 2025-01-14 at 14 36 32@2x

CleanShot 2025-01-14 at 14 36 10@2x

@Laisky Laisky changed the title Patch/gpt 4o audio feat: support gpt-4o-audio Jan 14, 2025
@Laisky Laisky changed the title feat: support gpt-4o-audio [WIP]feat: support gpt-4o-audio Jan 14, 2025
@Laisky Laisky changed the title [WIP]feat: support gpt-4o-audio feat: support gpt-4o-audio Jan 14, 2025
@WqyJh
Copy link
Contributor

WqyJh commented Jan 17, 2025

对于 stream 请求,请求体中加入 include_usage 参数,返回的其中一条消息会包含 usage。建议

  • fastpath: 直接修改请求体,强制插入这个参数,然后记录返回的 usage。
  • slowpath: 自己算
"stream_options": {
  "include_usage": true
},
data: {"id":"chatcmpl-AqcNUZRReOSzmK4Bqntp7s5KwzaMR","object":"chat.completion.chunk","created":1737103944,"model":"gpt-4o-audio-preview-2024-12-17","service_tier":"default","system_fingerprint":"fp_58887f9c5a","choices":[],"usage":{"prompt_tokens":17,"completion_tokens":488,"total_tokens":505,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":409,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}}

- Refactor model name handling across multiple controllers to improve clarity and maintainability.
- Enhance error logging and handling for better debugging and request processing robustness.
- Update pricing models in accordance with new calculations, ensuring accuracy in the billing logic.
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