grok2api icon indicating copy to clipboard operation
grok2api copied to clipboard

question: Image-to-video upload via /v1/videos with input_reference fails with 403 from Cloudflare WAF on POST /rest/app-chat/upload-file.

Open nodesshablya opened this issue 7 months ago • 6 comments

问题

Image-to-video upload via /v1/videos with input_reference fails with 403 from Cloudflare WAF on POST /rest/app-chat/upload-file.

curl_cffi sends base64 image as JSON payload. Cloudflare blocks large payloads (>5KB) but allows small ones (<5KB). This means the TLS fingerprint passes for small requests but triggers WAF rules for large POST bodies.

Test results from inside the container (same token, same headers, same session):

  • 444 bytes payload → 400 (CF passed, Grok: "image too small") ✅
  • 2,900 bytes payload (compressed 200x200 JPEG) → 200 (upload OK, video generated) ✅
  • 259,652 bytes payload (original 752x1360 JPEG) → 403 "Just a moment..." ❌

Tested with clearance_mode=none, clearance_mode=flaresolverr, and WARP proxy — same result. cf_clearance is valid (verified by successful small upload).

Text-to-video works fine. Only image-to-video fails because of the upload step.

Question: Is there a recommended way to handle this? Would auto-compressing images before upload be acceptable?

上下文(配置 / 日志)

Log:
asset upload request failed: status=403 body=<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title>

nodesshablya avatar Apr 10 '26 18:04 nodesshablya

暂时没有复现出 403,能否提供更多的测试案例?

查询 WAF 的限制为:

Image

我在本地用 6MB 的JPEG 文件上传也未出现此问题。


The 403 error hasn't been reproduced yet. Could you provide more test cases?

The WAF query limit is:

Image

I didn't encounter this problem when uploading a 6MB JPEG file locally.

chenyme avatar Apr 12 '26 07:04 chenyme

暂时没有复现出 403,能否提供更多的测试案例?

查询 WAF 的限制为:

Image 我在本地用 6MB 的JPEG 文件上传也未出现此问题。

The 403 error hasn't been reproduced yet. Could you provide more test cases?

The WAF query limit is:

Image I didn't encounter this problem when uploading a 6MB JPEG file locally.

作者,我发现了这个问题,我经过大量测试,发现只有当上传带人脸的图片用于编辑或者生成视频的时候才会跳403,而且cf过不去。使用不带人脸的图片是根本没有问题的。跟图片尺寸大小无关。

LucasJun avatar Apr 14 '26 10:04 LucasJun

作者,我发现了这个问题,我经过大量测试,发现只有当上传带人脸的图片用于编辑或者生成视频的时候才会跳403,而且cf过不去。使用不带人脸的图片是根本没有问题的。跟图片尺寸大小无关。

是的,我也验证了一下,出现人脸的图片,确实会弹出 CF 验证且无法过盾

chenyme avatar Apr 20 '26 03:04 chenyme

有好的解决办法吗?

lxm235521-netizen avatar Apr 23 '26 10:04 lxm235521-netizen

有好的解决办法吗?

你可以试试二改版本,我尝试有些二改版本是可以的

1471980509 avatar Apr 24 '26 13:04 1471980509

有好的解决办法吗?

你可以试试二改版本,我尝试有些二改版本是可以的

有推荐吗?

lxm235521-netizen avatar Apr 24 '26 14:04 lxm235521-netizen