Skip to content

Commit 2358c05

Browse files
committed
fix(api): improve agent detection for gpt-5-codex model
Enhanced model detection logic to properly handle gpt-5-codex requests
1 parent 6d37956 commit 2358c05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/copilot/create-chat-completions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ export const createChatCompletions = async (
2222
["assistant", "tool"].includes(msg.role),
2323
)
2424

25-
// Check if model starts with "claude-" (should also be treated as agent)
25+
// Check if model starts with "claude-" or is "gpt-5-codex" (should also be treated as agent)
2626
const isClaudeModel = payload.model.startsWith("claude-")
27+
const isGpt5Codex = payload.model === "gpt-5-codex"
2728

2829
// Build headers and add X-Initiator
2930
const headers: Record<string, string> = {
3031
...copilotHeaders(state, enableVision),
31-
"X-Initiator": isAgentCall || isClaudeModel ? "agent" : "user",
32+
"X-Initiator":
33+
isAgentCall || isClaudeModel || isGpt5Codex ? "agent" : "user",
3234
}
3335

3436
const response = await fetch(`${copilotBaseUrl(state)}/chat/completions`, {

0 commit comments

Comments
 (0)