@bitkyc08/opencodex 1.9.2 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitkyc08/opencodex",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "Universal provider proxy for OpenAI Codex — use any LLM with Codex CLI/App/SDK",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -22,6 +22,26 @@ export const FORWARD_HEADERS = [
22
22
  "x-responsesapi-include-timing-metrics",
23
23
  ];
24
24
 
25
+ function sanitizeReasoningInputContent(body: unknown): unknown {
26
+ if (!body || typeof body !== "object" || Array.isArray(body)) return body;
27
+ const raw = body as Record<string, unknown>;
28
+ if (!Array.isArray(raw.input)) return body;
29
+
30
+ let changed = false;
31
+ const input = raw.input.map(item => {
32
+ if (!item || typeof item !== "object" || Array.isArray(item)) return item;
33
+ const rec = item as Record<string, unknown>;
34
+ if (rec.type !== "reasoning" || !Array.isArray(rec.content) || rec.content.length === 0) return item;
35
+ changed = true;
36
+ // Routed models can produce raw `reasoning_text` output items. Codex echoes those in later
37
+ // native GPT requests, but ChatGPT's Responses backend accepts reasoning input only with empty
38
+ // `content`; keep summaries/ids and drop the raw content so native passthrough does not 400.
39
+ return { ...rec, content: [] };
40
+ });
41
+
42
+ return changed ? { ...raw, input } : body;
43
+ }
44
+
25
45
  export function createResponsesPassthroughAdapter(provider: OcxProviderConfig): ProviderAdapter & { passthrough: true } {
26
46
  return {
27
47
  name: "openai-responses",
@@ -49,7 +69,7 @@ export function createResponsesPassthroughAdapter(provider: OcxProviderConfig):
49
69
  url,
50
70
  method: "POST",
51
71
  headers,
52
- body: JSON.stringify(parsed._rawBody),
72
+ body: JSON.stringify(sanitizeReasoningInputContent(parsed._rawBody)),
53
73
  };
54
74
  },
55
75