PageSourceSearch

https://docs.1min.ai/assets/js/864fd85a.4c5c8910.js

js 1min.ai collected 2026-10-02 14:05:45 UTC 13,884 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[641],{1271:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>p,default:()=>m,frontMatter:()=>c,metadata:()=>i,toc:()=>u});const i=JSON.parse('{"id":"api/ai-for-image/image-generator/flux-2-klein-4b-image-generation","title":"Flux 2 Klein 4B - Image Generator","description":"Flux 2 Klein 4B - Image Generator","source":"@site/docs/api/ai-for-image/image-generator/flux-2-klein-4b.mdx","sourceDirName":"api/ai-for-image/image-generator","slug":"/api/ai-for-image/image-generator/flux-2-klein-4b-image-generation","permalink":"/docs/api/ai-for-image/image-generator/flux-2-klein-4b-image-generation","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"current","frontMatter":{"id":"flux-2-klein-4b-image-generation","title":"Flux 2 Klein 4B - Image Generator","description":"Flux 2 Klein 4B - Image Generator","sidebar_label":"Flux 2 Klein 4B","custom_edit_url":null},"sidebar":"apisidebar","previous":{"title":"Flux 2 Max","permalink":"/docs/api/ai-for-image/image-generator/flux-2-max-image-generation"},"next":{"title":"Flux 2 Klein 9B","permalink":"/docs/api/ai-for-image/image-generator/flux-2-klein-9b-image-generation"}}');var r=n(4848),a=n(8453),l=n(1470),s=n(9365),d=n(1028),o=n(1696);const c={id:"flux-2-klein-4b-image-generation",title:"Flux 2 Klein 4B - Image Generator",description:"Flux 2 Klein 4B - Image Generator",sidebar_label:"Flux 2 Klein 4B",custom_edit_url:null},p="Flux 2 Klein 4B - Image Generator",h={},u=[{value:"Endpoint",id:"endpoint",level:2},{value:"Request Headers",id:"request-headers",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Prompt Object Parameters",id:"prompt-object-parameters",level:3},{value:"Code Examples",id:"code-examples",level:2},{value:"Interactive Playground",id:"interactive-playground",level:2},{value:"Response Format",id:"response-format",level:2},{value:"Use Cases",id:"use-cases",level:2},{value:"Notes",id:"notes",level:2}];function x(e){const t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"flux-2-klein-4b---image-generator",children:"Flux 2 Klein 4B - Image Generator"})}),"\n",(0,r.jsx)(t.p,{children:"Compact 4 billion parameter image generation model by Black Forest Labs. 4-step distilled for sub-second inference, making it ideal for real-time applications, high-volume pipelines, and interactive products that need fast, quality image generation."}),"\n",(0,r.jsx)(t.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,r.jsxs)("div",{className:"api-endpoint",children:[(0,r.jsx)("span",{className:"badge badge--success",children:"POST"}),(0,r.jsx)("code",{children:(0,r.jsx)(t.a,{href:"https://api.1min.ai/api/features",children:"https://api.1min.ai/api/features"})})]}),"\n",(0,r.jsx)(t.h2,{id:"request-headers",children:"Request Headers"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Field"}),(0,r.jsx)(t.th,{children:"Value"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"API-KEY"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"<api-key>"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"Content-Type"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"application/json"})})]})]})]}),"\n",(0,r.jsx)(t.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Parameter"}),(0,r.jsx)(t.th,{children:"Type"}),(0,r.jsx)(t.th,{children:"Required"}),(0,r.jsx)(t.th,{children:"Description"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"type"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"Yes"}),(0,r.jsxs)(t.td,{children:["Must be ",(0,r.jsx)(t.code,{children:"IMAGE_GENERATOR"})]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"model"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"Yes"}),(0,r.jsxs)(t.td,{children:["Must be ",(0,r.jsx)(t.code,{children:"black-forest-labs/flux-2-klein-4b"})]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"promptObject"})}),(0,r.jsx)(t.td,{children:"object"}),(0,r.jsx)(t.td,{children:"Yes"}
1),(0,r.jsx)(t.td,{children:"Configuration object containing all generation parameters"})]})]})]}),"\n",(0,r.jsx)(t.h3,{id:"prompt-object-parameters",children:"Prompt Object Parameters"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Parameter"}),(0,r.jsx)(t.th,{children:"Type"}),(0,r.jsx)(t.th,{children:"Required"}),(0,r.jsx)(t.th,{children:"Description"}),(0,r.jsx)(t.th,{children:"Default"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"prompt"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"Yes"}),(0,r.jsx)(t.td,{children:"Text description of the image to generate"}),(0,r.jsx)(t.td,{children:"-"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"aspect_ratio"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Image aspect ratio (1:1, 16:9, 9:16, 3:2, 2:3, 4:5, 5:4)"}),(0,r.jsx)(t.td,{children:"1:1"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"output_format"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Output file format (webp, jpg, png)"}),(0,r.jsx)(t.td,{children:"webp"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"output_quality"})}),(0,r.jsx)(t.td,{children:"number"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Output image quality (0-100)"}),(0,r.jsx)(t.td,{children:"80"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"num_inference_steps"})}),(0,r.jsx)(t.td,{children:"number"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Number of inference steps (1-4)"}),(0,r.jsx)(t.td,{children:"4"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"go_fast"})}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Enable fastest generation mode"}),(0,r.jsx)(t.td,{children:"true"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"megapixels"})}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Output resolution in megapixels (0.25, 1)"}),(0,r.jsx)(t.td,{children:"1"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"disable_safety_checker"})}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Disable built-in safety filtering"}),(0,r.jsx)(t.td,{children:"false"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"seed"})}),(0,r.jsx)(t.td,{children:"number"}),(0,r.jsx)(t.td,{children:"No"}),(0,r.jsx)(t.td,{children:"Random seed for reproducibility"}),(0,r.jsx)(t.td,{children:"Random"})]})]})]}),"\n",(0,r.jsx)(t.h2,{id:"code-examples",children:"Code Examples"}),"\n",(0,r.jsxs)(l.A,{children:[(0,r.jsx)(s.A,{value:"curl",label:"cURL",default:!0,children:(0,r.jsx)(d.A,{language:"bash",children:'curl --location \'https://api.1min.ai/api/features\' \\\n--header \'API-KEY: <api-key>\' \\\n--header \'Content-Type: application/json\' \\\n--data \'{\n"type": "IMAGE_GENERATOR",\n"model": "black-forest-labs/flux-2-klein-4b",\n"promptObject": {\n  "prompt": "A serene mountain lake at dawn, misty atmosphere, photorealistic",\n  "aspect_ratio": "16:9",\n  "num_inference_steps": 4,\n  "go_fast": true,\n  "megapixels": "1",\n  "output_format": "webp",\n  "output_quality": 80\n}\n}\''})}),(0,r.jsx)(s.A,{value:"javascript",label:"JavaScript",children:(0,r.jsx)(d.A,{language:"javascript",children:"fetch('https://api.1min.ai/api/features', {\nmethod: 'POST',\nheaders: {\n  'Content-Type': 'application/json',\n  'API-KEY': 'YOUR_API_KEY'\n},\nbody: JSON.stringify({\n  type: 'IMAGE_GENERATOR',\n  model: 'black-forest-labs/flux-2-klein-4b',\n  promptObject: {\n    prompt: 'A serene mountain lake at dawn, misty atmosphere, photorealistic',\n    aspect_ratio: '16:9',\n    num_inference_steps: 4,\n    go_fast: true,\n    megapixels: '1',\n    output_format: 'webp',\n    output_quality: 80\n  }\n})\n})"})}),(0,r.jsx)(s.A,{value:"python",label:"Python",children:(0,r.jsx)(d.A,{language:"python",children:'import requests\n\nurl = "https://api.1min.ai/api/features"\nheaders = {\n"Content-Type": "application/json",\n"API-KEY": "YOUR_API_KEY"\n}\n\ndata = {\n"type": "IMAGE_GENERATOR",\n"model": "black-forest-labs/flux-2-klein-4b",\n"promptObject": {\n  "prompt": "A serene mountain lake at dawn, misty atmosphere, photorealistic",\n  "aspect_ratio": "16:9",\n  "num_inference_steps": 4,\n  "go_fast": True,\n  "megapixels": "1",\n  "output_format": "webp",\n  "output_quality": 80\n}\n}\n\nresponse = requests.post(url, headers=headers, json=data)'})})]}),"\n",(0,r.jsx)(t.h2,{id:"interactive-playground",children:"Interactive Playground"}),"\n",(0,r.jsx)(o.A,{endpoint:"/api/features",method:"POST",baseUrl:"https://api.1min.ai",defaultHeaders:{"API-KEY":"<your-api-key>","Content-Type":"application/json"},defaultBody:{type:"IMAGE_GENERATOR",model:"black-forest-labs/flux-2-klein-4b",promptObject:{prompt:"A serene mountain lake at dawn, misty atmosphere, photorealistic",aspect_ratio:"16:9",num_inference_steps:4,go_fast:!0,megapixels:"1",output_format:"webp",output_quality:80}},parameterConfig:[{path:"model",label:"AI Model",type:"select",required:!0,options:[{label:"Flux 2 Klein 4B - Black Forest Labs",value:"black-forest-labs/flux-2-klein-4b"}],getValue:e=>e.model},{path:"promptObject.prompt",label:"Prompt",type:"textarea",required:!0,description:"Describe the image you want to generate",placeholder:"A serene mountain lake at dawn, misty atmosphere, photorealistic",getValue:e=>e.promptObject?.prompt},{path:"promptObject.aspect_ratio",label:"Aspect Ratio",type:"select",required:!1,options:[{label:"1:1 - Square",value:"1:1"},{label:"16:9 - Widescreen",value:"16:9"},{label:"9:16 - Vertical",value:"9:16"},{label:"3:2 - Photography",value:"3:2"},{label:"2:3 - Portrait",value:"2:3"},{label:"4:5 - Instagram",value:"4:5"},{label:"5:4 - Landscape",value:"5:4"}],getValue:e=>e.promptObject?.aspect_ratio},{path:"promptObject.num_inference_steps",label:"Inference Steps",type:"number",required:!1,description:"Number of inference steps (1-4)",placeholder:"4",min:1,max:4,getValue:e=>e.promptObject?.num_inference_steps},{path:"promptObject.megapixels",label:"Megapixels",type:"select",required:!1,options:[{label:"0.25 MP (~512\xd7512)",value:"
10.25"},{label:"1 MP (~1024\xd71024)",value:"1"}],getValue:e=>e.promptObject?.megapixels},{path:"promptObject.go_fast",label:"Go Fast",type:"select",required:!1,options:[{label:"True",value:!0},{label:"False",value:!1}],getValue:e=>e.promptObject?.go_fast},{path:"promptObject.output_quality",label:"Output Quality",type:"number",required:!1,description:"Output image quality (0-100)",placeholder:"80",min:0,max:100,getValue:e=>e.promptObject?.output_quality},{path:"promptObject.seed",label:"Seed",type:"number",required:!1,description:"Random seed for reproducibility",placeholder:"12345",min:0,max:4294967295,getValue:e=>e.promptObject?.seed}]}),"\n",(0,r.jsx)(t.h2,{id:"response-format",children:"Response Format"}),"\n",(0,r.jsx)(d.A,{language:"json",children:'{\n"aiRecord": {\n  "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",\n  "model": "black-forest-labs/flux-2-klein-4b",\n  "type": "IMAGE_GENERATOR",\n  "status": "SUCCESS",\n  "createdAt": "2026-03-27T10:00:00.000Z",\n  "aiRecordDetail": {\n    "promptObject": {\n      "prompt": "A serene mountain lake at dawn, misty atmosphere, photorealistic",\n      "aspect_ratio": "16:9",\n      "num_inference_steps": 4,\n      "go_fast": true,\n      "megapixels": "1",\n      "output_format": "webp",\n      "output_quality": 80\n    },\n    "resultObject": [\n      "development/images/2026_03_27_10_00_01_001_mountain_lake.webp"\n    ]\n  },\n  "temporaryUrl": "https://s3.us-east-1.amazonaws.com/asset.1min.ai/development/images/2026_03_27_10_00_01_001_mountain_lake.webp?..."\n}\n}'}),"\n",(0,r.jsx)(t.h2,{id:"use-cases",children:"Use Cases"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"Real-time Applications"}),": Sub-second generation for interactive tools"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"High-volume Pipelines"}),": Cost-efficient bulk image generation"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"Rapid Prototyping"}),": Near-instant concept visualization"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"Mobile Apps"}),": Fast generation for resource-sensitive environments"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"Creative Iteration"}),": Quick multi-variation generation workflows"]}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsx)(t.admonition,{title:"Speed-First Model",type:"tip",children:(0,r.jsx)(t.p,{children:"Flux 2 Klein 4B is optimized for speed with 4-step distillation. For higher fidelity output, consider Flux 2 Dev or Flux 2 Pro."})})]})}function m(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(x,{...e})}):x(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.