AI Workers
Phoenix 1p0 (Text to Image)
Generate images from text prompts via the Linconwaves AI Workers API.
Phoenix 1p0 (slug: phoenix-1p0) generates images from text prompts.
Endpoint
- URL:
POST /:modelSlugwithmodelSlug = phoenix-1p0 - Auth:
Authorization: Bearer <api_key> - Content-Type:
application/json - Base URL:
https://aiworker.linconwaves.com
Request
{
"prompt": "A cozy cabin in the snow at sunset, cinematic lighting."
}Notes:
- Keep prompts concise for faster latency.
Response
- Binary image stream (
Content-Type: image/pngor similar), or base64 image underimage/result.image. Errors return JSON{ "error": "...", "detail"?: "..." }with HTTP codes (400/401/499/500).
Curl example
curl -X POST https://aiworker.linconwaves.com/phoenix-1p0 \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data '{"prompt": "A cozy cabin in the snow at sunset, cinematic lighting."}' \
--output phoenix-1p0.pngJavaScript (fetch)
const resp = await fetch('https://aiworker.linconwaves.com/phoenix-1p0', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.API_KEY}`,
},
body: JSON.stringify({
"prompt": "A cozy cabin in the snow at sunset, cinematic lighting."
}),
});
if (resp.headers.get("content-type")?.includes("image")) {
const buf = await resp.arrayBuffer();
// use buf to save/display image
} else {
const data = await resp.json();
if (!resp.ok) {
throw new Error(data.error || `Request failed (${resp.status})`);
}
const b64 = data.image || data.result?.image;
if (typeof b64 === "string") {
const bin = atob(b64);
const bytes = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
const url = URL.createObjectURL(new Blob([bytes], { type: "image/png" }));
// display or download via `url`
}
}Error codes
401 Unauthorized— Missing/invalid API key.400 Bad Request— Invalid payload (e.g., missingprompt).499 Client Closed Request— Request aborted by client.500— Upstream model error or unexpected failure.
Backend snippets
const BASE = 'https://aiworker.linconwaves.com';
const API_KEY = process.env.AIWORKER_API_KEY!;
const payload = {
"prompt": "A cozy cabin in the snow at sunset, cinematic lighting."
};
const res = await fetch(`${BASE}/phoenix-1p0`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_KEY}` ,
},
body: JSON.stringify(payload),
});
const data = await res.json();
console.log(data);Frontend snippets
// app/api/aiworker/route.ts
const BASE = 'https://aiworker.linconwaves.com';
const API_KEY = process.env.AIWORKER_API_KEY!;
export async function POST(req: Request) {
const payload = await req.json();
const res = await fetch(`${BASE}/phoenix-1p0`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_KEY}` ,
},
body: JSON.stringify(payload),
});
return new Response(await res.text(), { status: res.status, headers: res.headers });
}Related
- Playground: Dashboard → Playground → select “Phoenix 1p0”.