Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9ec32671
authored
Aug 12, 2025
by
Calcium-Ion
Committed by
GitHub
Aug 12, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1569 from duyazhe/codex/cloudflare-responses
feat: add responses support for cloudflare
parents
f10d469b
8df5a458
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
relay/channel/cloudflare/adaptor.go
+10
-2
No files found.
relay/channel/cloudflare/adaptor.go
View file @
9ec32671
...
...
@@ -8,6 +8,7 @@ import (
"net/http"
"one-api/dto"
"one-api/relay/channel"
"one-api/relay/channel/openai"
relaycommon
"one-api/relay/common"
"one-api/relay/constant"
"one-api/types"
...
...
@@ -38,6 +39,8 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
return
fmt
.
Sprintf
(
"%s/client/v4/accounts/%s/ai/v1/chat/completions"
,
info
.
BaseUrl
,
info
.
ApiVersion
),
nil
case
constant
.
RelayModeEmbeddings
:
return
fmt
.
Sprintf
(
"%s/client/v4/accounts/%s/ai/v1/embeddings"
,
info
.
BaseUrl
,
info
.
ApiVersion
),
nil
case
constant
.
RelayModeResponses
:
return
fmt
.
Sprintf
(
"%s/client/v4/accounts/%s/ai/v1/responses"
,
info
.
BaseUrl
,
info
.
ApiVersion
),
nil
default
:
return
fmt
.
Sprintf
(
"%s/client/v4/accounts/%s/ai/run/%s"
,
info
.
BaseUrl
,
info
.
ApiVersion
,
info
.
UpstreamModelName
),
nil
}
...
...
@@ -62,8 +65,7 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
}
func
(
a
*
Adaptor
)
ConvertOpenAIResponsesRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
dto
.
OpenAIResponsesRequest
)
(
any
,
error
)
{
// TODO implement me
return
nil
,
errors
.
New
(
"not implemented"
)
return
request
,
nil
}
func
(
a
*
Adaptor
)
DoRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
requestBody
io
.
Reader
)
(
any
,
error
)
{
...
...
@@ -110,6 +112,12 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycom
}
else
{
err
,
usage
=
cfHandler
(
c
,
info
,
resp
)
}
case
constant
.
RelayModeResponses
:
if
info
.
IsStream
{
usage
,
err
=
openai
.
OaiResponsesStreamHandler
(
c
,
info
,
resp
)
}
else
{
usage
,
err
=
openai
.
OaiResponsesHandler
(
c
,
info
,
resp
)
}
case
constant
.
RelayModeAudioTranslation
:
fallthrough
case
constant
.
RelayModeAudioTranscription
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment