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
b8b59a13
authored
Aug 07, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support deepseek claude format (convert)
parent
d37af13b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
dto/claude.go
+1
-1
relay/channel/deepseek/adaptor.go
+3
-4
service/convert.go
+4
-0
No files found.
dto/claude.go
View file @
b8b59a13
...
...
@@ -361,7 +361,7 @@ type ClaudeUsage struct {
CacheCreationInputTokens
int
`json:"cache_creation_input_tokens"`
CacheReadInputTokens
int
`json:"cache_read_input_tokens"`
OutputTokens
int
`json:"output_tokens"`
ServerToolUse
*
ClaudeServerToolUse
`json:"server_tool_use"`
ServerToolUse
*
ClaudeServerToolUse
`json:"server_tool_use
,omitempty
"`
}
type
ClaudeServerToolUse
struct
{
...
...
relay/channel/deepseek/adaptor.go
View file @
b8b59a13
...
...
@@ -24,10 +24,9 @@ func (a *Adaptor) ConvertGeminiRequest(*gin.Context, *relaycommon.RelayInfo, *dt
return
nil
,
errors
.
New
(
"not implemented"
)
}
func
(
a
*
Adaptor
)
ConvertClaudeRequest
(
*
gin
.
Context
,
*
relaycommon
.
RelayInfo
,
*
dto
.
ClaudeRequest
)
(
any
,
error
)
{
//TODO implement me
panic
(
"implement me"
)
return
nil
,
nil
func
(
a
*
Adaptor
)
ConvertClaudeRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
req
*
dto
.
ClaudeRequest
)
(
any
,
error
)
{
adaptor
:=
openai
.
Adaptor
{}
return
adaptor
.
ConvertClaudeRequest
(
c
,
info
,
req
)
}
func
(
a
*
Adaptor
)
ConvertAudioRequest
(
c
*
gin
.
Context
,
info
*
relaycommon
.
RelayInfo
,
request
dto
.
AudioRequest
)
(
io
.
Reader
,
error
)
{
...
...
service/convert.go
View file @
b8b59a13
...
...
@@ -283,8 +283,10 @@ func StreamResponseOpenAI2Claude(openAIResponse *dto.ChatCompletionsStreamRespon
if
chosenChoice
.
FinishReason
!=
nil
&&
*
chosenChoice
.
FinishReason
!=
""
{
// should be done
info
.
FinishReason
=
*
chosenChoice
.
FinishReason
if
!
info
.
Done
{
return
claudeResponses
}
}
if
info
.
Done
{
claudeResponses
=
append
(
claudeResponses
,
generateStopBlock
(
info
.
ClaudeConvertInfo
.
Index
))
oaiUsage
:=
info
.
ClaudeConvertInfo
.
Usage
...
...
@@ -432,6 +434,8 @@ func stopReasonOpenAI2Claude(reason string) string {
return
"end_turn"
case
"stop_sequence"
:
return
"stop_sequence"
case
"length"
:
fallthrough
case
"max_tokens"
:
return
"max_tokens"
case
"tool_calls"
:
...
...
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