[codex] Add streaming image previews and proxy deploy fixes#50
[codex] Add streaming image previews and proxy deploy fixes#50AkideLiu wants to merge 4 commits into
Conversation
|
没有别的意思,但是你自己测试完,真的觉得这个有用吗?我之前测试了自己的 Plus 号 Codex 放到 CPA 进行流式传输,官方那个 SSE 事件太少了,间隔还特别长,感觉完全不能缓解这个情况,最后还是靠 CPA 自己的那个非流式的 Keep Alive,我设置成 30 秒以后就好了。但问题是,New API 好像不是很愿意加这种功能。 然后这个中间过程图像获取还会收钱。 |
我测试之后能解决cloudflare 120s超时的问题。我是对接sub2api测试的,效果比较理想。中间状态在sub2api上看到不会收费 |
那你是设置了多少张中间图像呀? |
这个是由官方接口里面的partial image 决定的,一般是0-3张这样吧。 具体可以参见:https://developers.openai.com/api/docs/guides/image-generation?api=responses You can adjust the partial_images parameter to receive 0-3 partial images. 下面是测试结果,套了CF Tunnel和Cloudflare 轻松生成3:20s的图片:
我查看了一下SSE response里面的Ping的频率还是很高的:
|
额我意思是你自己设定的,因为我当时设定1张感觉完全没有用,算了,我晚上再测试吧 |
除了partial_image还会放回ping值,也就是图中的: |
啊?官方还会返回这个吗?难道是 CPA 在我测试时吞掉了?我晚上做的时候再看一下。不过可能合并还得上一点时间,因为正在做 Agent 模式。 |
我借到了一个朋友的OpenAI API官方key开Image API的流式测试,发现无论是否请求中间步骤图像,都是没有Ping的……主要还是靠中间步骤图像事件维持连接,和之前的结论差不多。 那基本上只能请求多一点中间步骤图像了。 |



Summary
images/generations,images/edits, andresponses, while keeping a JSON fallback for providers that ignore streaming.流式图片预览setting, URL import/export support, and defaults streaming previews to enabled for OpenAI profiles while preserving explicit opt-out.Referrer-Policy: unsafe-urlfor iframe embedding cases that need full referrer forwarding.Related issues
Cloudflare timeout notes
Docs:
Implementation details
image_generation.partial_image,image_edit.partial_image,image_generation.completed, andimage_edit.completedevents.response.image_generation_call.partial_image,response.completed, andresponse.output_item.doneimage outputs.streamImagesis true; FAL/custom provider defaults remain non-streaming.text/event-stream, the existing non-streaming parser is used.Validation
npm testnpm run builddocker build -f deploy/Dockerfile -t gpt-image-playground:pr-50 .