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
c70fa24e
authored
Feb 05, 2026
by
Seefs
Committed by
GitHub
Feb 05, 2026
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2826 from dahetaoa/fix-codex-and-sqlite
fix: optimize Codex relay
parents
b3934e83
b2d79ce4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
relay/channel/codex/adaptor.go
+16
-0
No files found.
relay/channel/codex/adaptor.go
View file @
c70fa24e
...
...
@@ -90,6 +90,12 @@ func (a *Adaptor) ConvertOpenAIResponsesRequest(c *gin.Context, info *relaycommo
}
}
}
// Codex backend requires the `instructions` field to be present.
// Keep it consistent with Codex CLI behavior by defaulting to an empty string.
if
len
(
request
.
Instructions
)
==
0
{
request
.
Instructions
=
json
.
RawMessage
(
`""`
)
}
if
isCompact
{
return
request
,
nil
}
...
...
@@ -172,5 +178,15 @@ func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Header, info *rel
req
.
Set
(
"originator"
,
"codex_cli_rs"
)
}
// chatgpt.com/backend-api/codex/responses is strict about Content-Type.
// Clients may omit it or include parameters like `application/json; charset=utf-8`,
// which can be rejected by the upstream. Force the exact media type.
req
.
Set
(
"Content-Type"
,
"application/json"
)
if
info
.
IsStream
{
req
.
Set
(
"Accept"
,
"text/event-stream"
)
}
else
if
req
.
Get
(
"Accept"
)
==
""
{
req
.
Set
(
"Accept"
,
"application/json"
)
}
return
nil
}
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