1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/chroma";
const data = {
"prompt": "Close-up portrait of a young knight in shining armor, holding a sword, set against a medieval castle background, dramatic lighting.",
"negative_prompt": "low quality, ugly, deformed, blurry, bad anatomy, distorted, unrealistic",
"width": 1024,
"height": 1024,
"aspect_ratio": "1:1 square 1024x1024",
"cfg": 7,
"sampler_name": "euler",
"scheduler": "beta",
"steps": 40,
"seed": 123456789,
"samples": 1,
"image_format": "png",
"image_quality": 95,
"base64": false
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();
Describes the imagery scene; specific details yield rich images. Use for artistic depiction.
Excludes undesirable elements; keeps image focus clear. Useful for professional look.
Defines image width in pixels; adjust for different display needs.
min : 768,
max : 2048
Sets image height; balance with width for proper ratio.
min : 768,
max : 2048
Selects image shape; square fits media platforms well.
Allowed values:
Guides prompt adherence; higher values mean more accuracy.
min : 1,
max : 20
Selects image sampling; 'euler' for balanced quality and speed.
Allowed values:
Manages noise schedule; 'beta' for smooth transitions.
Allowed values:
Changes denoising steps; more steps for enhanced detail.
min : 10,
max : 75
Fixes randomness; set for replicable outcomes.
Number of images generated; adjust for more options.
Output format choice; 'png' offers high quality.
Allowed values:
Sets image detail level; 95 for fine detail.
min : 1,
max : 100
Outputs image as base64 string; useful for embedding.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Chroma is an advanced, 8.9-billion-parameter text-to-image AI model crafted with the FLUX.1-schnell architecture, designed for those seeking to harness the potential of generative AI. Its high-fidelity text-to-image synthesis capabilities allow users to create detailed, imaginative visuals from simple text prompts. Leveraging Chroma's open-source nature enables a broader scope of experimentation and creative freedom.
For developers, Chroma offers the ability to automate and streamline workflows with its efficient and stable architectural enhancements. By integrating the model into existing pipelines through custom scripting or APIs, developers can generate diverse visual assets at scale, thus boosting productivity and innovation. Furthermore, its open-source flexibility invites developers to fine-tune the model on specific datasets, enabling customized solutions tailored to unique business needs.
Creators, such as artists and designers, can expedite project timelines by utilizing Chroma for rapid prototyping and asset generation. Artists can craft vivid media concepts by merely articulating creative ideas in natural language, while marketing teams can use Chroma to generate unique campaign visuals without relying on stock images.
Executives will appreciate Chroma's strategic advantages, including its potential to reduce costs associated with traditional design processes and enhance ROI through innovative visual content creation. Additionally, by facilitating community-driven research, Chroma opens doors for ongoing improvements and benchmarking within the diffusion model landscape.
In summary, Chroma represents a transformational tool in text-to-image generation. By mastering prompt engineering and utilizing quality control processes, users can unlock unprecedented creativity and efficiency across various domains.
Discovering Chroma’s potential begins with mastering prompt engineering and selecting parameters that match your creative goals. Follow these guidelines to generate striking, high-quality images across a range of use cases.
Prompt Engineering
• Be specific and descriptive: “A futuristic city skyline at sunset with neon reflections” yields richer results than “city.”
• Use style cues: mention artists, mediums, lighting, or color palettes (for example, “in the style of Impressionist oil painting”).
• Employ negative prompts to filter out unwanted artifacts (“low quality, blurry, deformed, unrealistic”).
Core Parameters
• Width/Height: Choose between 768–2048 px. For social media, a square (1:1, 1024×1024) works well; for portraits, try 896×1152 (3:4); for landscapes, 1344×768 (16:9).
• CFG Scale: Balances creativity vs. prompt fidelity. Set 5–7 for artistic exploration, 8–12 for photorealism, and up to 15 for maximum adherence on precise concepts.
• Steps: Number of denoising iterations. 20–30 for quick drafts, 40–50 for balanced detail, 60–75 for ultra-fine rendering.
• Sampler:
– “euler” or “euler_a” for speed and good quality
– “heun” or “lms” for smoother results
– “dpmpp_2s_a” or “dpmpp_sde” for highest fidelity
• Scheduler: “karras” or “beta” ensure smooth noise scheduling; “exponential” can yield more stylized textures.
• Seed: Fix a seed for reproducible outputs, or leave blank for random variation.
• Samples: Increase to 3–5 to explore variations in one batch.
Use-Case Recommendations
• Iterate: start with a strong core prompt and refine with additional details or negative terms.
• Batch generation: use multiple samples to compare styles and pick the best.
• Post-processing: minor color correction or upscaling can polish final assets.
By fine-tuning these parameters and iterating on your text prompts, you’ll unlock Chroma’s full creative power and produce visuals tailored to any project.