Environment
-
Hosted ChatKit workflow (OpenAI-managed /v1/chatkit/*)
-
Custom app uploads screenshots to its own /api/chatkit/files for GPT Vision Analysis, returns ImageAttachment objects ({ id, type: “image”, mime_type: “image/png”, preview_url: “/api/chatkit/attachments/” })
-
Attachments served via FastAPI (Agents SDK) with both GET and HEAD implemented and exposed through ngrok
-
Screenshot pipeline: BPMN modeler.saveSVG() → svgToPng() → → canvas.toDataURL(‘image/png’) → uploaded as PNG
Steps to Reproduce
-
Opening the hosted ChatKit panel in my app.
-
Clicking the “Screenshot” button (calls sendCanvasToChat → ui:ai:attachImage).
-
The client POSTs to our upload proxy:
POST https://procmod.test:3000/api/chatkit/files
→ 200
→ body:
{
"attachment": {
"id": "atc_14d17d71",
"type": "image",
"mime_type": "image/png",
"name": "Canvas-Snapshot.png",
"preview_url": "https://xxxxxxx.dev/api/chatkit/attachments/atc_14d17d71",
"upload_url": null
}
}
- ChatKit immediately calls threads.add_user_message with that attachment:
POST https://api.openai.com/v1/chatkit/conversation
{
"type": "threads.add_user_message",
"params": {
"input": {
"content": [
{ "type": "input_text", "text": "Canvas Snapshot" }
],
"quoted_text": "",
"attachments": ["atc_14d17d71"],
"inference_options": {}
},
"thread_id": "cthr_691d7fe35bdc81949f95d4b876b69b43028e75a668a6dd4a"
}
}
- Response is always HTTP 500 with the generic error, no additional information in the hosted iframe (CORS hides it):
HTTP/1.1 500 Internal Server Error
x-request-id: 60eeacec-707a-4443-a084-b87abcdcb7b4
(open latest curl replay → `x-request-id: b49053e4-7b94-4167-b278-2f34e86b8de1`)
Body:
{
"error": {
"message": "The server had an error processing your request...",
"type": "server_error"
}
}
- We verified this outside the browser by replaying the same payload via curl with a fresh client_secret (from /api/chatkit/refresh). Result is the same 500:
curl -i https://api.openai.com/v1/chatkit/conversation \
-H "Authorization: Bearer <new client_secret>" \
-H "Content-Type: application/json" \
--data '{"type":"threads.add_user_message", ... }'
→ HTTP/2 500
→ x-request-id: b49053e4-7b94-4167-b278-2f34e86b8de1
What we checked
-
The attachment preview URL is public and responds to both HEAD and GET (tested via curl).
-
Content-Type returned by our upload endpoint is image/png.
-
The pipeline never uploads SVGs; the only image/svg+xml request is the local blob: render prior to canvas.toDataURL(‘image/png’).
-
Fresh client_secrets fail as well; we see expired_ephemeral_key only when reusing old ones.
-
Text-only conversations on the same thread succeed (HTTP 200). The failure happens only when attachments includes our PNG id.
Expected
Hosted ChatKit should include the attachment and let the agent continue responding. If the attachment can’t be fetched or the format is unsupported, we expect a clear error (4xx with message) instead of a 500 with no body.
Actual
Call to /v1/chatkit/conversation fails with HTTP 500 and server_error regardless of attachment reachability. The iframe shows the generic “Beim Generieren … ist ein Fehler aufgetreten” error and the turn aborts. We have multiple request ids documenting the failure (60eeacec-707a-4443-a084-b87abcdcb7b4, b49053e4-7b94-4167-b278-2f34e86b8de1).
Questions
-
Is mixing hosted ChatKit conversations with custom /api/chatkit/files uploads supported? Docs describe the ImageAttachment shape but don’t mention restrictions when the storage lives on our own server.
-
If the attachment fails validation, could the hosted pipeline return a specific error instead of a generic 500?
-
What additional logging or request ids do you need to investigate


