Add OpenAI Responses support

This commit is contained in:
Luis Pater
2025-09-02 09:07:44 +08:00
parent e11637dc62
commit ce5d2bad97
54 changed files with 2378 additions and 144 deletions

View File

@@ -6,6 +6,7 @@
package claude
import (
"bytes"
"fmt"
"github.com/luispater/CLIProxyAPI/internal/misc"
@@ -31,7 +32,9 @@ import (
//
// Returns:
// - []byte: The transformed request data in internal client format
func ConvertClaudeRequestToCodex(modelName string, rawJSON []byte, _ bool) []byte {
func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool) []byte {
rawJSON := bytes.Clone(inputRawJSON)
template := `{"model":"","instructions":"","input":[]}`
instructions := misc.CodexInstructions

View File

@@ -35,7 +35,7 @@ var (
//
// Returns:
// - []string: A slice of strings, each containing a Claude Code-compatible JSON response
func ConvertCodexResponseToClaude(_ context.Context, _ string, rawJSON []byte, param *any) []string {
func ConvertCodexResponseToClaude(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, rawJSON []byte, param *any) []string {
if *param == nil {
hasToolCall := false
*param = &hasToolCall
@@ -168,6 +168,6 @@ func ConvertCodexResponseToClaude(_ context.Context, _ string, rawJSON []byte, p
//
// Returns:
// - string: A Claude Code-compatible JSON response containing all message content and metadata
func ConvertCodexResponseToClaudeNonStream(_ context.Context, _ string, _ []byte, _ *any) string {
func ConvertCodexResponseToClaudeNonStream(_ context.Context, _ string, originalRequestRawJSON, requestRawJSON, _ []byte, _ *any) string {
return ""
}