Chat & Images API
WriteIQ provides synchronous utility endpoints for Chat IQ and Images IQ, allowing you to quickly integrate AI capabilities into your applications without waiting for a background workflow.
Chat API
Section titled “Chat API”POST /v1/chat
A conversational endpoint that provides access to the WriteIQ intelligent assistant, featuring optional live web browsing.
Request Body
Section titled “Request Body”| Field | Type | Description |
|---|---|---|
messages | array | Required. An array of message objects, each containing a role (“user”, “assistant”) and content string. |
useWebSearch | boolean | Optional. If true, the assistant will use live SERP data to inform its response. Defaults to false. |
Example Request
Section titled “Example Request”curl -X POST https://api.writeiq.com/v1/chat \ -H "Authorization: Bearer wiq_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "What is the latest Google Core Update?" } ], "useWebSearch": true }'Example Response
Section titled “Example Response”{ "response": "The latest Google Core Update, rolled out in..."}Images API
Section titled “Images API”POST /v1/images
Generate high-quality hero images or infographics using Cloudflare’s native Stable Diffusion XL binding.
Request Body
Section titled “Request Body”| Field | Type | Description |
|---|---|---|
prompt | string | Required. A detailed description of the image you want to generate. |
style | string | Optional. The visual style (e.g., “photorealistic”, “illustration”, “3d render”). Defaults to “photorealistic”. |
Example Request
Section titled “Example Request”curl -X POST https://api.writeiq.com/v1/images \ -H "Authorization: Bearer wiq_YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "A modern workspace with a mechanical keyboard and a cup of coffee", "style": "photorealistic" }'Example Response
Section titled “Example Response”{ "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."}Note: The
urlfield currently returns a Base64 encoded Data URL string representing the raw image bytes. You can directly embed this into an<img>tag or upload it to your own CDN.