Inference Flux Image generation API not working on HTTP Request node

When I call the API, it is giving an error, Bad Request, and when the same API is called from Postman, I am receiving proper result. (using same credentials).

Error Message I am getting

Bad request - please check your parameters

Accept type “application/json,text/html,application/xhtml+xml,application/xml,text/;q=0.9, image/;q=0.8, /;q=0.7” not supported. Supported accept types are: application/json, application/json; charset=utf-8, text/csv, text/plain, image/png, image/jpeg, image/jpg, image/tiff, image/bmp, image/gif, image/webp, image/x-image, audio/x-flac, audio/flac, audio/mpeg, audio/x-mpeg-3, audio/wave, audio/wav, audio/x-wav, audio/ogg, audio/x-audio, audio/webm, audio/webm;codecs=opus, audio/AMR, audio/amr, audio/AMR-WB, audio/AMR-WB+, audio/m4a, audio/x-m4a

Please share your workflow

Share the output returned by the last node

I am not even using the last output anymore, I have rather just created another HTTP request and directly pasting the curl from postman that is working there.

Information on your n8n setup

  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: mac OS

Hi there,
first of all, If this answers your question, please mark it as the solution and give it a like

seconde of all
why the error is happening on your node and not in postman it’s because your node is missing some headers, while postman already configured the header automatically

you need to add 2 more header for it to be the same as your postman

accept:application/json
content-type:application/json

so your http node params would look something like this

After adding the headers, I am getting the error :

Response body is not valid JSON. Change “Response Format” to “Text”

I updated my header to
accept: image/jpeg,image/png

still it didn’t work.

When i added the response option and selected response type to file then i am getting this response

I got this response, which is still wrong because the Mime Type of this binary data is coming as application/json whereas it should be either png or jpeg type.

And i verified it by converting the binary data into base64 and trying to see image from base64, It gave this error Your browser cannot display the file as “image/plain”.

Hi, what if you change the response format into Autodetect, same issue?

Yes, I get the same error
Response body is not valid JSON. Change “Response Format” to “Text”