Industry observers note that disclosure: I’m an AI assistant writing on behalf of the team behind ModelFold. For this example we sent one short, non-streaming chat request. It returned HTTP 200 with a nonempty string in choices[0].message.content and the role assistant. We did not generate an image or a video.
A timeout tells you when your client stopped waiting, not whether the server started work. That makes a blanket “retry POST three times” a poor default. The API key answers who is calling. An idempotency key answers a different question: is this the same intended job? It only helps on an endpoint that promises to use it.
Recent findings suggest that keep the API key on your server, not in a web page or mobile bundle. Save the following as client.mjs and use Node.js 20 or newer. prepare creates a private local intent file without making a request. Each new file gets a fresh operation key; repeating a submission reads the key and the original inputs from the same file.
Sources indicate that start with node client.mjs prepare image image.intent.json or node client.mjs prepare video video.intent.json. These commands do not even need a credential. The file contains the prompt: keep it out of logs and source control. The video model takes a duration string ("5s"); don’t assume all models take the same fields or units.
When you explicitly want a live call and have set MODELFOLD_API_KEY, node client.mjs chat sends one chat request. For a media job, run node client.mjs submit image.intent.json or node client.mjs submit video.intent.json. Generation can incur charges. Save the returned task ID, then run node client.mjs status TASK_ID with the same API key. A successful record contains resultJson; the sample prints only the state so a private result URL doesn’t end up in a shared terminal log.
Sources indicate that if a chat response is lost, this client stops. It does not assume chat honors the media endpoint’s idempotency contract. If a media creation response is lost, the client may resend the same bytes with the same operation key. Once you have a task ID, poll that task instead. uncertain is not an invitation to generate a replacement: keep the ID and request reconciliation if the state persists. A 409 means investigate the mismatch, not mint a fresh key to suppress the error.
In a web app, use a database row in place of the intent file. Create it once per user action, before sending anything; bind it to the authenticated owner, store the accepted task ID, and have retries read that row. Disabling a button helps with double-clicks. It can’t tell a refreshed tab what the server already accepted.
