import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.images.create({
imageGenerationRequest: {
prompt: "A serene mountain landscape at sunset with a lake reflection",
quality: "hd",
},
});
console.log(result);
}
run();{
"created": 1704067200,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A serene mountain landscape at sunset with a calm lake reflection, digital art style"
}
]
}Creates AI-generated images from text descriptions.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.images.create({
imageGenerationRequest: {
prompt: "A serene mountain landscape at sunset with a lake reflection",
quality: "hd",
},
});
console.log(result);
}
run();{
"created": 1704067200,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A serene mountain landscape at sunset with a calm lake reflection, digital art style"
}
]
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
Request parameters for generating images. Creates one or more images from a text prompt.
A text description of the desired image(s). The maximum length is 1000 characters.
1 - 1000The model to use for image generation. Defaults to 'meetkai:z-image-turbo'.
The number of images to generate. Must be between 1 and 10. Defaults to 1.
1 <= x <= 10The quality of the image that will be generated. 'hd' creates images with finer details and greater consistency. Defaults to 'standard'.
standard, hd The format in which the generated images are returned. 'url' returns a URL to the image, 'b64_json' returns the image as a base64-encoded JSON string. Defaults to 'url'.
url, b64_json The size of the generated images. Must be one of 256x256, 512x512, 1024x1024, 1792x1024, or 1024x1792. Defaults to 1024x1024.
256x256, 512x512, 1024x1024, 1792x1024, 1024x1792 The style of the generated images. 'vivid' causes the model to lean towards generating hyper-real and dramatic images. 'natural' causes the model to produce more natural, less hyper-real looking images. Defaults to 'vivid'.
vivid, natural A unique identifier representing your end-user, which can help monitor and detect abuse.
OK
Was this page helpful?