kiapi 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kiapi/__init__.py +3 -0
- kiapi/__main__.py +4 -0
- kiapi/api/__init__.py +26 -0
- kiapi/api/_constants/require_auth.py +14 -0
- kiapi/api/_helpers/build_job_responses.py +73 -0
- kiapi/api/_helpers/build_openapi.py +55 -0
- kiapi/api/_helpers/build_train_responses.py +21 -0
- kiapi/api/_helpers/get_accept.py +20 -0
- kiapi/api/_helpers/get_ctx.py +7 -0
- kiapi/api/_helpers/get_worker.py +7 -0
- kiapi/api/_helpers/register_capability_endpoints.py +70 -0
- kiapi/api/_helpers/submit_and_maybe_wait.py +113 -0
- kiapi/api/_settings.py +50 -0
- kiapi/api/_views/async_job_response.py +21 -0
- kiapi/api/_views/capability_model_spec.py +49 -0
- kiapi/api/app.py +150 -0
- kiapi/api/audio/acestep/_views/extract_response.py +57 -0
- kiapi/api/audio/acestep/_views/track_response.py +57 -0
- kiapi/api/audio/acestep/router.py +190 -0
- kiapi/api/audio/audiogen/_views/audio_response.py +46 -0
- kiapi/api/audio/audiogen/router.py +77 -0
- kiapi/api/chat/_views/chat_completion_response.py +71 -0
- kiapi/api/chat/router.py +253 -0
- kiapi/api/embedding/_views/embedding_response.py +35 -0
- kiapi/api/embedding/router.py +82 -0
- kiapi/api/files/_operations/get_file.py +14 -0
- kiapi/api/files/_operations/get_file_id.py +18 -0
- kiapi/api/files/_views/file_delete_response.py +14 -0
- kiapi/api/files/_views/file_list_response.py +15 -0
- kiapi/api/files/router.py +105 -0
- kiapi/api/health/_views/health_response.py +26 -0
- kiapi/api/health/router.py +28 -0
- kiapi/api/image/depthpro/_views/estimate_response.py +70 -0
- kiapi/api/image/depthpro/router.py +81 -0
- kiapi/api/image/ernie/_views/image_response.py +50 -0
- kiapi/api/image/ernie/router.py +181 -0
- kiapi/api/image/flux2/_views/image_response.py +53 -0
- kiapi/api/image/flux2/router.py +197 -0
- kiapi/api/image/ideogram4/_views/image_response.py +55 -0
- kiapi/api/image/ideogram4/router.py +87 -0
- kiapi/api/image/qwen/_views/image_response.py +47 -0
- kiapi/api/image/qwen/router.py +141 -0
- kiapi/api/image/seedvr2/_views/image_response.py +50 -0
- kiapi/api/image/seedvr2/router.py +83 -0
- kiapi/api/image/zimage/_views/image_response.py +49 -0
- kiapi/api/image/zimage/router.py +131 -0
- kiapi/api/jobs/_operations/get_job_id.py +18 -0
- kiapi/api/jobs/_views/job_delete_response.py +19 -0
- kiapi/api/jobs/_views/job_list_response.py +15 -0
- kiapi/api/jobs/router.py +62 -0
- kiapi/api/models/_schemas/openai_model_spec.py +26 -0
- kiapi/api/models/_views/model_list_response.py +15 -0
- kiapi/api/models/router.py +29 -0
- kiapi/api/video/ltx2/_views/__init__.py +1 -0
- kiapi/api/video/ltx2/_views/video_response.py +59 -0
- kiapi/api/video/ltx2/router.py +89 -0
- kiapi/api/web/_views/__init__.py +7 -0
- kiapi/api/web/_views/fetch_api_request.py +26 -0
- kiapi/api/web/_views/fetch_error_response.py +25 -0
- kiapi/api/web/router.py +302 -0
- kiapi/capabilities/__init__.py +24 -0
- kiapi/capabilities/_exceptions/CapabilityError.py +2 -0
- kiapi/capabilities/_exceptions/ValidationError.py +2 -0
- kiapi/capabilities/_helpers/attach_mflux_progress.py +50 -0
- kiapi/capabilities/_helpers/get_file_path.py +20 -0
- kiapi/capabilities/_helpers/resolve_file_ref.py +16 -0
- kiapi/capabilities/acestep/README.ja.md +174 -0
- kiapi/capabilities/acestep/README.md +167 -0
- kiapi/capabilities/acestep/__init__.py +37 -0
- kiapi/capabilities/acestep/_constants/description.py +122 -0
- kiapi/capabilities/acestep/_exceptions/ace_step_engine_error.py +2 -0
- kiapi/capabilities/acestep/_helpers/register.py +96 -0
- kiapi/capabilities/acestep/_models/acestep.py +105 -0
- kiapi/capabilities/acestep/_operations/handle_cover.py +23 -0
- kiapi/capabilities/acestep/_operations/handle_extract.py +38 -0
- kiapi/capabilities/acestep/_operations/handle_generate.py +18 -0
- kiapi/capabilities/acestep/_operations/handle_repaint.py +25 -0
- kiapi/capabilities/acestep/_operations/resolve_ace_step_paths.py +30 -0
- kiapi/capabilities/acestep/_operations/resolve_cover_params.py +21 -0
- kiapi/capabilities/acestep/_operations/resolve_engine.py +10 -0
- kiapi/capabilities/acestep/_operations/resolve_extract_params.py +24 -0
- kiapi/capabilities/acestep/_operations/resolve_generate_params.py +18 -0
- kiapi/capabilities/acestep/_operations/resolve_repaint_params.py +22 -0
- kiapi/capabilities/acestep/_schemas/ace_step_paths.py +29 -0
- kiapi/capabilities/acestep/_services/ace_step_engine.py +143 -0
- kiapi/capabilities/acestep/_settings.py +82 -0
- kiapi/capabilities/acestep/_views/ace_step_base.py +61 -0
- kiapi/capabilities/acestep/_views/cover_params.py +26 -0
- kiapi/capabilities/acestep/_views/cover_request.py +49 -0
- kiapi/capabilities/acestep/_views/extract_params.py +24 -0
- kiapi/capabilities/acestep/_views/extract_request.py +33 -0
- kiapi/capabilities/acestep/_views/generate_params.py +25 -0
- kiapi/capabilities/acestep/_views/generate_request.py +54 -0
- kiapi/capabilities/acestep/_views/repaint_params.py +27 -0
- kiapi/capabilities/acestep/_views/repaint_request.py +51 -0
- kiapi/capabilities/acestep/_views/track_params.py +7 -0
- kiapi/capabilities/acestep/worker_subprocess.py +247 -0
- kiapi/capabilities/audiogen/README.ja.md +49 -0
- kiapi/capabilities/audiogen/README.md +48 -0
- kiapi/capabilities/audiogen/__init__.py +25 -0
- kiapi/capabilities/audiogen/_constants/description.py +60 -0
- kiapi/capabilities/audiogen/_helpers/attach_audiogen_progress.py +27 -0
- kiapi/capabilities/audiogen/_helpers/register.py +42 -0
- kiapi/capabilities/audiogen/_helpers/validate_generate.py +14 -0
- kiapi/capabilities/audiogen/_models/audiogen.py +98 -0
- kiapi/capabilities/audiogen/_operations/handle_generate.py +27 -0
- kiapi/capabilities/audiogen/_operations/resolve_generate_params.py +25 -0
- kiapi/capabilities/audiogen/_settings.py +34 -0
- kiapi/capabilities/audiogen/_views/generate_params.py +14 -0
- kiapi/capabilities/audiogen/_views/generate_request.py +96 -0
- kiapi/capabilities/chat/README.ja.md +822 -0
- kiapi/capabilities/chat/README.md +806 -0
- kiapi/capabilities/chat/__init__.py +25 -0
- kiapi/capabilities/chat/_constants/description.py +163 -0
- kiapi/capabilities/chat/_helpers/register.py +67 -0
- kiapi/capabilities/chat/_models/qwen3_5.py +183 -0
- kiapi/capabilities/chat/_models/qwen3_omni.py +242 -0
- kiapi/capabilities/chat/_operations/apply_template.py +74 -0
- kiapi/capabilities/chat/_operations/completed_hermes_tool_call_text.py +9 -0
- kiapi/capabilities/chat/_operations/emit_streaming_response.py +297 -0
- kiapi/capabilities/chat/_operations/ensure_streaming_detokenizer_compat.py +49 -0
- kiapi/capabilities/chat/_operations/format_response.py +72 -0
- kiapi/capabilities/chat/_operations/handle_chat.py +25 -0
- kiapi/capabilities/chat/_operations/parse_hermes_tool_calls.py +63 -0
- kiapi/capabilities/chat/_operations/parse_json_tool_calls.py +66 -0
- kiapi/capabilities/chat/_operations/parse_messages.py +326 -0
- kiapi/capabilities/chat/_operations/resolve_chat_params.py +50 -0
- kiapi/capabilities/chat/_operations/stream_text_from_tokens.py +32 -0
- kiapi/capabilities/chat/_operations/strip_tool_calls.py +15 -0
- kiapi/capabilities/chat/_settings.py +74 -0
- kiapi/capabilities/chat/_utils/apply_parallel_tool_call_policy.py +17 -0
- kiapi/capabilities/chat/_utils/apply_seed.py +8 -0
- kiapi/capabilities/chat/_utils/load_audio_mono.py +31 -0
- kiapi/capabilities/chat/_utils/load_mlx_vlm.py +12 -0
- kiapi/capabilities/chat/_utils/warmup_params.py +26 -0
- kiapi/capabilities/chat/_views/chat_params.py +34 -0
- kiapi/capabilities/chat/_views/chat_request.py +153 -0
- kiapi/capabilities/depthpro/README.ja.md +131 -0
- kiapi/capabilities/depthpro/README.md +124 -0
- kiapi/capabilities/depthpro/__init__.py +23 -0
- kiapi/capabilities/depthpro/_constants/description.py +39 -0
- kiapi/capabilities/depthpro/_helpers/register.py +46 -0
- kiapi/capabilities/depthpro/_helpers/validate_estimate.py +32 -0
- kiapi/capabilities/depthpro/_models/depthpro.py +144 -0
- kiapi/capabilities/depthpro/_operations/handle_estimate.py +50 -0
- kiapi/capabilities/depthpro/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/depthpro/_operations/resolve_estimate_params.py +24 -0
- kiapi/capabilities/depthpro/_settings.py +46 -0
- kiapi/capabilities/depthpro/_views/estimate_params.py +21 -0
- kiapi/capabilities/depthpro/_views/estimate_request.py +63 -0
- kiapi/capabilities/embedding/README.ja.md +137 -0
- kiapi/capabilities/embedding/README.md +128 -0
- kiapi/capabilities/embedding/__init__.py +24 -0
- kiapi/capabilities/embedding/_constants/description.py +47 -0
- kiapi/capabilities/embedding/_helpers/register.py +66 -0
- kiapi/capabilities/embedding/_models/qwen3_text.py +53 -0
- kiapi/capabilities/embedding/_models/qwen3_vl.py +97 -0
- kiapi/capabilities/embedding/_operations/format_response.py +24 -0
- kiapi/capabilities/embedding/_operations/handle_embed.py +24 -0
- kiapi/capabilities/embedding/_operations/parse_inputs.py +108 -0
- kiapi/capabilities/embedding/_operations/resolve_embed_params.py +18 -0
- kiapi/capabilities/embedding/_settings.py +27 -0
- kiapi/capabilities/embedding/_utils/to_vector.py +20 -0
- kiapi/capabilities/embedding/_views/embed_params.py +17 -0
- kiapi/capabilities/embedding/_views/embed_request.py +39 -0
- kiapi/capabilities/ernie/README.ja.md +242 -0
- kiapi/capabilities/ernie/README.md +223 -0
- kiapi/capabilities/ernie/__init__.py +34 -0
- kiapi/capabilities/ernie/_constants/description.py +71 -0
- kiapi/capabilities/ernie/_helpers/register.py +60 -0
- kiapi/capabilities/ernie/_helpers/validate_edit.py +19 -0
- kiapi/capabilities/ernie/_helpers/validate_generate.py +8 -0
- kiapi/capabilities/ernie/_models/ernie.py +356 -0
- kiapi/capabilities/ernie/_operations/handle_edit.py +39 -0
- kiapi/capabilities/ernie/_operations/handle_generate.py +38 -0
- kiapi/capabilities/ernie/_operations/handle_train.py +77 -0
- kiapi/capabilities/ernie/_operations/is_quantize_override.py +16 -0
- kiapi/capabilities/ernie/_operations/resolve_edit_params.py +44 -0
- kiapi/capabilities/ernie/_operations/resolve_generate_params.py +40 -0
- kiapi/capabilities/ernie/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/ernie/_operations/resolve_train_params.py +43 -0
- kiapi/capabilities/ernie/_operations/validate_common.py +33 -0
- kiapi/capabilities/ernie/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/ernie/_settings.py +151 -0
- kiapi/capabilities/ernie/_views/edit_params.py +36 -0
- kiapi/capabilities/ernie/_views/edit_request.py +142 -0
- kiapi/capabilities/ernie/_views/generate_params.py +32 -0
- kiapi/capabilities/ernie/_views/generate_request.py +127 -0
- kiapi/capabilities/ernie/_views/train_params.py +28 -0
- kiapi/capabilities/ernie/_views/train_request.py +96 -0
- kiapi/capabilities/flux2/README.ja.md +260 -0
- kiapi/capabilities/flux2/README.md +241 -0
- kiapi/capabilities/flux2/__init__.py +36 -0
- kiapi/capabilities/flux2/_constants/description.py +81 -0
- kiapi/capabilities/flux2/_helpers/register.py +98 -0
- kiapi/capabilities/flux2/_helpers/validate_edit.py +12 -0
- kiapi/capabilities/flux2/_helpers/validate_generate.py +8 -0
- kiapi/capabilities/flux2/_models/flux2.py +396 -0
- kiapi/capabilities/flux2/_operations/handle_edit.py +44 -0
- kiapi/capabilities/flux2/_operations/handle_generate.py +46 -0
- kiapi/capabilities/flux2/_operations/handle_train.py +105 -0
- kiapi/capabilities/flux2/_operations/is_quantize_override.py +16 -0
- kiapi/capabilities/flux2/_operations/resolve_edit_params.py +43 -0
- kiapi/capabilities/flux2/_operations/resolve_generate_params.py +44 -0
- kiapi/capabilities/flux2/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/flux2/_operations/resolve_train_params.py +42 -0
- kiapi/capabilities/flux2/_operations/role_spec.py +13 -0
- kiapi/capabilities/flux2/_operations/split_repo.py +11 -0
- kiapi/capabilities/flux2/_operations/validate_common.py +35 -0
- kiapi/capabilities/flux2/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/flux2/_settings.py +181 -0
- kiapi/capabilities/flux2/_views/edit_params.py +36 -0
- kiapi/capabilities/flux2/_views/edit_request.py +145 -0
- kiapi/capabilities/flux2/_views/generate_params.py +36 -0
- kiapi/capabilities/flux2/_views/generate_request.py +150 -0
- kiapi/capabilities/flux2/_views/train_params.py +32 -0
- kiapi/capabilities/flux2/_views/train_request.py +102 -0
- kiapi/capabilities/ideogram4/README.ja.md +230 -0
- kiapi/capabilities/ideogram4/README.md +219 -0
- kiapi/capabilities/ideogram4/__init__.py +24 -0
- kiapi/capabilities/ideogram4/_constants/description.py +65 -0
- kiapi/capabilities/ideogram4/_helpers/register.py +44 -0
- kiapi/capabilities/ideogram4/_helpers/validate_generate.py +31 -0
- kiapi/capabilities/ideogram4/_models/ideogram4.py +120 -0
- kiapi/capabilities/ideogram4/_operations/handle_generate.py +30 -0
- kiapi/capabilities/ideogram4/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/ideogram4/_operations/resolve_generate_params.py +30 -0
- kiapi/capabilities/ideogram4/_settings.py +89 -0
- kiapi/capabilities/ideogram4/_views/generate_params.py +27 -0
- kiapi/capabilities/ideogram4/_views/generate_request.py +118 -0
- kiapi/capabilities/ltx2/README.ja.md +287 -0
- kiapi/capabilities/ltx2/README.md +274 -0
- kiapi/capabilities/ltx2/__init__.py +26 -0
- kiapi/capabilities/ltx2/_constants/description.py +81 -0
- kiapi/capabilities/ltx2/_helpers/register.py +58 -0
- kiapi/capabilities/ltx2/_helpers/validate_generate.py +42 -0
- kiapi/capabilities/ltx2/_models/ltx2.py +106 -0
- kiapi/capabilities/ltx2/_operations/detect_mode.py +19 -0
- kiapi/capabilities/ltx2/_operations/handle_generate.py +52 -0
- kiapi/capabilities/ltx2/_operations/resolve_generate_params.py +31 -0
- kiapi/capabilities/ltx2/_settings.py +93 -0
- kiapi/capabilities/ltx2/_views/generate_params.py +34 -0
- kiapi/capabilities/ltx2/_views/generate_request.py +151 -0
- kiapi/capabilities/qwen/README.ja.md +251 -0
- kiapi/capabilities/qwen/README.md +235 -0
- kiapi/capabilities/qwen/__init__.py +30 -0
- kiapi/capabilities/qwen/_constants/description.py +53 -0
- kiapi/capabilities/qwen/_helpers/register.py +60 -0
- kiapi/capabilities/qwen/_helpers/validate_edit.py +12 -0
- kiapi/capabilities/qwen/_helpers/validate_generate.py +12 -0
- kiapi/capabilities/qwen/_models/qwen.py +224 -0
- kiapi/capabilities/qwen/_operations/handle_edit.py +44 -0
- kiapi/capabilities/qwen/_operations/handle_generate.py +46 -0
- kiapi/capabilities/qwen/_operations/is_quantize_override.py +15 -0
- kiapi/capabilities/qwen/_operations/resolve_edit_params.py +35 -0
- kiapi/capabilities/qwen/_operations/resolve_generate_params.py +39 -0
- kiapi/capabilities/qwen/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/qwen/_operations/validate_common.py +32 -0
- kiapi/capabilities/qwen/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/qwen/_settings.py +107 -0
- kiapi/capabilities/qwen/_views/edit_params.py +36 -0
- kiapi/capabilities/qwen/_views/edit_request.py +138 -0
- kiapi/capabilities/qwen/_views/generate_params.py +37 -0
- kiapi/capabilities/qwen/_views/generate_request.py +149 -0
- kiapi/capabilities/seedvr2/README.ja.md +234 -0
- kiapi/capabilities/seedvr2/README.md +219 -0
- kiapi/capabilities/seedvr2/__init__.py +24 -0
- kiapi/capabilities/seedvr2/_constants/description.py +46 -0
- kiapi/capabilities/seedvr2/_helpers/register.py +60 -0
- kiapi/capabilities/seedvr2/_helpers/validate_upscale.py +52 -0
- kiapi/capabilities/seedvr2/_models/seedvr2.py +140 -0
- kiapi/capabilities/seedvr2/_operations/handle_upscale.py +42 -0
- kiapi/capabilities/seedvr2/_operations/is_quantize_override.py +12 -0
- kiapi/capabilities/seedvr2/_operations/resolve_upscale_params.py +30 -0
- kiapi/capabilities/seedvr2/_settings.py +74 -0
- kiapi/capabilities/seedvr2/_views/upscale_params.py +27 -0
- kiapi/capabilities/seedvr2/_views/upscale_request.py +94 -0
- kiapi/capabilities/web/README.ja.md +187 -0
- kiapi/capabilities/web/README.md +171 -0
- kiapi/capabilities/web/__init__.py +30 -0
- kiapi/capabilities/web/_constants/description.py +38 -0
- kiapi/capabilities/web/_exceptions/FetchError.py +24 -0
- kiapi/capabilities/web/_exceptions/SearchBackendError.py +11 -0
- kiapi/capabilities/web/_helpers/register.py +59 -0
- kiapi/capabilities/web/_models/crawl4ai.py +32 -0
- kiapi/capabilities/web/_models/searxng.py +44 -0
- kiapi/capabilities/web/_operations/handle_fetch.py +145 -0
- kiapi/capabilities/web/_operations/handle_search.py +56 -0
- kiapi/capabilities/web/_operations/resolve_fetch_params.py +19 -0
- kiapi/capabilities/web/_operations/resolve_search_params.py +34 -0
- kiapi/capabilities/web/_operations/resolve_searxng_config_dir.py +21 -0
- kiapi/capabilities/web/_services/__init__.py +1 -0
- kiapi/capabilities/web/_services/web_backend_process.py +144 -0
- kiapi/capabilities/web/_settings.py +138 -0
- kiapi/capabilities/web/_views/fetch_params.py +27 -0
- kiapi/capabilities/web/_views/fetch_request.py +29 -0
- kiapi/capabilities/web/_views/fetch_result.py +20 -0
- kiapi/capabilities/web/_views/search_params.py +43 -0
- kiapi/capabilities/web/_views/search_request.py +93 -0
- kiapi/capabilities/web/_views/search_response.py +49 -0
- kiapi/capabilities/web/resources/__init__.py +0 -0
- kiapi/capabilities/web/resources/searxng/__init__.py +0 -0
- kiapi/capabilities/web/resources/searxng/settings.yml +11 -0
- kiapi/capabilities/zimage/README.ja.md +249 -0
- kiapi/capabilities/zimage/README.md +231 -0
- kiapi/capabilities/zimage/__init__.py +34 -0
- kiapi/capabilities/zimage/_constants/description.py +73 -0
- kiapi/capabilities/zimage/_helpers/register.py +62 -0
- kiapi/capabilities/zimage/_helpers/validate_generate.py +37 -0
- kiapi/capabilities/zimage/_models/zimage.py +278 -0
- kiapi/capabilities/zimage/_operations/handle_generate.py +38 -0
- kiapi/capabilities/zimage/_operations/handle_train.py +78 -0
- kiapi/capabilities/zimage/_operations/is_quantize_override.py +11 -0
- kiapi/capabilities/zimage/_operations/resolve_generate_params.py +39 -0
- kiapi/capabilities/zimage/_operations/resolve_lora_params.py +23 -0
- kiapi/capabilities/zimage/_operations/resolve_train_params.py +38 -0
- kiapi/capabilities/zimage/_schemas/lora_ref.py +27 -0
- kiapi/capabilities/zimage/_settings.py +166 -0
- kiapi/capabilities/zimage/_views/generate_params.py +23 -0
- kiapi/capabilities/zimage/_views/generate_request.py +127 -0
- kiapi/capabilities/zimage/_views/train_params.py +22 -0
- kiapi/capabilities/zimage/_views/train_request.py +101 -0
- kiapi/cli/__init__.py +11 -0
- kiapi/cli/_helpers/dedupe_resources.py +12 -0
- kiapi/cli/_helpers/register_all_capabilities.py +36 -0
- kiapi/cli/_helpers/run_resources.py +24 -0
- kiapi/cli/_helpers/select_specs.py +67 -0
- kiapi/cli/activate/_operations/preflight_hf_access.py +129 -0
- kiapi/cli/activate/cli.py +37 -0
- kiapi/cli/check/_helpers/check_audio_acestep_turbo.py +22 -0
- kiapi/cli/check/_helpers/check_audio_acestep_xl_base.py +22 -0
- kiapi/cli/check/_helpers/check_audio_audiogen_medium.py +24 -0
- kiapi/cli/check/_helpers/check_chat_chat_qwen3_6_27b.py +19 -0
- kiapi/cli/check/_helpers/check_chat_chat_qwen3_omni.py +19 -0
- kiapi/cli/check/_helpers/check_embedding_embedding_qwen3_embedding_8b.py +14 -0
- kiapi/cli/check/_helpers/check_embedding_embedding_qwen3_vl_embedding_2b.py +19 -0
- kiapi/cli/check/_helpers/check_image_depthpro_base.py +21 -0
- kiapi/cli/check/_helpers/check_image_ernie_base.py +23 -0
- kiapi/cli/check/_helpers/check_image_ernie_turbo.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_9b.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_base_4b.py +23 -0
- kiapi/cli/check/_helpers/check_image_flux2_klein_base_9b.py +23 -0
- kiapi/cli/check/_helpers/check_image_ideogram4_fp8.py +23 -0
- kiapi/cli/check/_helpers/check_image_qwen_edit_2509.py +27 -0
- kiapi/cli/check/_helpers/check_image_qwen_image.py +23 -0
- kiapi/cli/check/_helpers/check_image_seedvr2_3b.py +23 -0
- kiapi/cli/check/_helpers/check_image_seedvr2_7b.py +23 -0
- kiapi/cli/check/_helpers/check_image_zimage_base.py +23 -0
- kiapi/cli/check/_helpers/check_image_zimage_turbo.py +23 -0
- kiapi/cli/check/_helpers/check_video_ltx2_distilled.py +26 -0
- kiapi/cli/check/_helpers/check_web_web_fetch.py +14 -0
- kiapi/cli/check/_helpers/check_web_web_search.py +14 -0
- kiapi/cli/check/_operations/build_check_result.py +20 -0
- kiapi/cli/check/_operations/check_context.py +10 -0
- kiapi/cli/check/_operations/create_sample_image.py +46 -0
- kiapi/cli/check/_schemas/check_result.py +12 -0
- kiapi/cli/check/cli.py +89 -0
- kiapi/cli/cli.py +29 -0
- kiapi/cli/config/cli.py +17 -0
- kiapi/cli/config/edit/cli.py +32 -0
- kiapi/cli/config/init/cli.py +33 -0
- kiapi/cli/config/show/cli.py +13 -0
- kiapi/cli/config/template/cli.py +36 -0
- kiapi/cli/deactivate/cli.py +49 -0
- kiapi/cli/run/asgi.py +16 -0
- kiapi/cli/run/cli.py +59 -0
- kiapi/cli/service/__init__.py +5 -0
- kiapi/cli/service/_services/service_manager.py +107 -0
- kiapi/cli/service/cli.py +19 -0
- kiapi/cli/service/install/cli.py +17 -0
- kiapi/cli/service/start/cli.py +22 -0
- kiapi/cli/service/status/cli.py +81 -0
- kiapi/cli/service/stop/cli.py +19 -0
- kiapi/cli/service/uninstall/cli.py +16 -0
- kiapi/cli/status/cli.py +226 -0
- kiapi/core/app/__init__.py +16 -0
- kiapi/core/app/_schemas/app_context.py +28 -0
- kiapi/core/app/_services/user_directory.py +59 -0
- kiapi/core/app/_settings.py +46 -0
- kiapi/core/capability/__init__.py +11 -0
- kiapi/core/capability/_schemas/capability_spec.py +17 -0
- kiapi/core/capability/_services/capability_spec_registry.py +21 -0
- kiapi/core/config/__init__.py +11 -0
- kiapi/core/config/_exceptions/user_config_error.py +2 -0
- kiapi/core/config/_helpers/get_user_settings_path.py +7 -0
- kiapi/core/config/_helpers/load_user_settings.py +54 -0
- kiapi/core/file/__init__.py +37 -0
- kiapi/core/file/_helpers/create_file_store.py +7 -0
- kiapi/core/file/_helpers/resolve_file_ref.py +90 -0
- kiapi/core/file/_schemas/file_data_url_ref.py +19 -0
- kiapi/core/file/_schemas/file_id_ref.py +16 -0
- kiapi/core/file/_schemas/file_record.py +46 -0
- kiapi/core/file/_schemas/file_url_ref.py +16 -0
- kiapi/core/file/_services/file_store.py +138 -0
- kiapi/core/file/_settings.py +22 -0
- kiapi/core/file/_types/file_id.py +2 -0
- kiapi/core/file/_types/file_ref.py +12 -0
- kiapi/core/file/_views/resolved_file_ref.py +16 -0
- kiapi/core/job/__init__.py +24 -0
- kiapi/core/job/_enums/job_status.py +9 -0
- kiapi/core/job/_helpers/creep_progress.py +123 -0
- kiapi/core/job/_models/job.py +121 -0
- kiapi/core/job/_services/job_store.py +33 -0
- kiapi/core/job/_services/progress_reporter.py +79 -0
- kiapi/core/job/_types/job_id.py +3 -0
- kiapi/core/job/_types/job_result.py +5 -0
- kiapi/core/job/_types/job_type.py +4 -0
- kiapi/core/logging/__init__.py +14 -0
- kiapi/core/logging/_helpers/get_log_level.py +8 -0
- kiapi/core/logging/_helpers/setup_logger.py +14 -0
- kiapi/core/logging/_settings.py +34 -0
- kiapi/core/logging/_types/log_level.py +3 -0
- kiapi/core/memory/__init__.py +21 -0
- kiapi/core/memory/_exceptions/memory_budget_error.py +2 -0
- kiapi/core/memory/_helpers/create_memory_manager.py +17 -0
- kiapi/core/memory/_operations/log_memory_limit.py +29 -0
- kiapi/core/memory/_operations/resolve_effective_memory_limit_gb.py +13 -0
- kiapi/core/memory/_operations/resolve_framework_strategy.py +42 -0
- kiapi/core/memory/_schemas/framework_strategy.py +14 -0
- kiapi/core/memory/_schemas/memory_stats.py +24 -0
- kiapi/core/memory/_schemas/resident_model.py +14 -0
- kiapi/core/memory/_schemas/resident_model_stats.py +49 -0
- kiapi/core/memory/_services/memory_manager.py +257 -0
- kiapi/core/memory/_settings.py +36 -0
- kiapi/core/memory/_types/framework_name.py +4 -0
- kiapi/core/memory/_types/resident_key.py +4 -0
- kiapi/core/model/__init__.py +36 -0
- kiapi/core/model/_exceptions/unknown_model_error.py +2 -0
- kiapi/core/model/_schemas/model_spec.py +145 -0
- kiapi/core/model/_services/model_registry.py +85 -0
- kiapi/core/model/_types/model_alias.py +2 -0
- kiapi/core/model/_types/model_domain.py +6 -0
- kiapi/core/model/_types/model_family.py +5 -0
- kiapi/core/model/_types/model_key.py +8 -0
- kiapi/core/model/_types/model_name.py +4 -0
- kiapi/core/model/_types/model_repo.py +3 -0
- kiapi/core/net/__init__.py +16 -0
- kiapi/core/net/_exceptions/unsafe_url_error.py +7 -0
- kiapi/core/net/_helpers/verify_public_url.py +68 -0
- kiapi/core/net/_settings.py +28 -0
- kiapi/core/setup/__init__.py +25 -0
- kiapi/core/setup/_exceptions/setup_required_error.py +2 -0
- kiapi/core/setup/_schemas/docker_image_resource.py +37 -0
- kiapi/core/setup/_schemas/hf_snapshot_resource.py +50 -0
- kiapi/core/setup/_schemas/local_path_resource.py +43 -0
- kiapi/core/setup/_schemas/python_package_resource.py +58 -0
- kiapi/core/setup/_schemas/python_venv_resource.py +63 -0
- kiapi/core/setup/_schemas/setup_status.py +7 -0
- kiapi/core/setup/_schemas/url_file_resource.py +43 -0
- kiapi/core/setup/_services/setup_manager.py +331 -0
- kiapi/core/setup/_types/setup_resource.py +21 -0
- kiapi/core/setup/_types/setup_target.py +11 -0
- kiapi/core/workdir/__init__.py +8 -0
- kiapi/core/workdir/_helpers/create_work_dir.py +11 -0
- kiapi/core/workdir/_settings.py +21 -0
- kiapi/core/worker/__init__.py +23 -0
- kiapi/core/worker/_helpers/create_worker.py +9 -0
- kiapi/core/worker/_services/worker.py +165 -0
- kiapi/core/worker/_settings.py +36 -0
- kiapi/core/worker/_types/job_thunk.py +6 -0
- kiapi-0.1.0.dist-info/METADATA +337 -0
- kiapi-0.1.0.dist-info/RECORD +465 -0
- kiapi-0.1.0.dist-info/WHEEL +4 -0
- kiapi-0.1.0.dist-info/entry_points.txt +2 -0
- kiapi-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""LTX-2 capability defaults + caps, read from ``KIAPI_LTX2_`` env vars."""
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
5
|
+
from pydantic_settings_manager import SettingsManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LTX2Settings(BaseSettings):
|
|
9
|
+
"""Settings for LTX-2 models, video dimensions, frame counts, and progress display."""
|
|
10
|
+
|
|
11
|
+
model_config = SettingsConfigDict(
|
|
12
|
+
env_prefix="KIAPI_LTX2_",
|
|
13
|
+
extra="ignore",
|
|
14
|
+
protected_namespaces=(),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
model_repo: str = Field(
|
|
18
|
+
default="prince-canuma/LTX-2-distilled",
|
|
19
|
+
title="LTX-2 model repo",
|
|
20
|
+
description="Hugging Face repo ID for the LTX-2 model used for video generation.",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
text_encoder_repo: str | None = Field(
|
|
24
|
+
default=None,
|
|
25
|
+
title="Text encoder repo",
|
|
26
|
+
description=(
|
|
27
|
+
"Hugging Face repo ID for a text encoder from a separate repo.\n"
|
|
28
|
+
"When None, the model's default text encoder is used."
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# --------------------------------------------------
|
|
33
|
+
# generate
|
|
34
|
+
# --------------------------------------------------
|
|
35
|
+
|
|
36
|
+
max_num_frames: int = Field(
|
|
37
|
+
default=721,
|
|
38
|
+
title="Maximum frame count",
|
|
39
|
+
description="Upper limit for the video frame count accepted in a request.",
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
max_width: int = Field(
|
|
43
|
+
default=768,
|
|
44
|
+
title="Maximum width",
|
|
45
|
+
description="Upper pixel limit for the video width accepted in a request.",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
max_height: int = Field(
|
|
49
|
+
default=768,
|
|
50
|
+
title="Maximum height",
|
|
51
|
+
description="Upper pixel limit for the video height accepted in a request.",
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
default_width: int = Field(
|
|
55
|
+
default=512,
|
|
56
|
+
title="Default width",
|
|
57
|
+
description="Video width in pixels used when a request omits width.",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
default_height: int = Field(
|
|
61
|
+
default=512,
|
|
62
|
+
title="Default height",
|
|
63
|
+
description="Video height in pixels used when a request omits height.",
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
default_num_frames: int = Field(
|
|
67
|
+
default=97,
|
|
68
|
+
title="Default frame count",
|
|
69
|
+
description="Generated frame count used when a request omits num_frames.",
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
default_fps: int = Field(
|
|
73
|
+
default=24,
|
|
74
|
+
title="Default FPS",
|
|
75
|
+
description="Output video FPS used when a request omits fps.",
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# mlx-video exposes no per-step hook, so we creep a synthetic 'liveness'
|
|
79
|
+
# progress on a time-based schedule while it runs (keeps polling agents
|
|
80
|
+
# waiting); the schedule is paced to hit ~80% at this expected duration. Base
|
|
81
|
+
# seconds for a 97-frame 512x512 job; scaled by frame count and resolution.
|
|
82
|
+
# 0 disables the creep (progress stays at the coarse 0.0 until completion).
|
|
83
|
+
progress_eta_base_s: float = Field(
|
|
84
|
+
default=90.0,
|
|
85
|
+
title="Progress ETA base seconds",
|
|
86
|
+
description=(
|
|
87
|
+
"Expected seconds for synthetic progress, based on a 97-frame 512x512 LTX-2 job.\n"
|
|
88
|
+
"The value is scaled by frame count and resolution. Set to 0 to disable it."
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
settings_manager = SettingsManager(LTX2Settings)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Resolved LTX-2 generation parameters used by the model layer."""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GenerateParams(BaseModel):
|
|
7
|
+
model: str = Field(description="Resolved model variant used for the run.")
|
|
8
|
+
|
|
9
|
+
prompt: str = Field(description="Prompt used for the generation.")
|
|
10
|
+
seed: int = Field(description="Resolved seed; generated when request seed is null.")
|
|
11
|
+
width: int = Field(description="Resolved output width in pixels.")
|
|
12
|
+
height: int = Field(description="Resolved output height in pixels.")
|
|
13
|
+
num_frames: int = Field(description="Resolved output frame count.")
|
|
14
|
+
fps: int = Field(description="Resolved output frame rate.")
|
|
15
|
+
image_strength: float = Field(description="Resolved first-frame strength.")
|
|
16
|
+
end_image_strength: float | None = Field(
|
|
17
|
+
description="Resolved last-frame strength, or null when omitted."
|
|
18
|
+
)
|
|
19
|
+
generate_audio: bool = Field(
|
|
20
|
+
description="Whether LTX-2 should synthesize synchronized audio."
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def gen_params(self) -> dict:
|
|
24
|
+
return {
|
|
25
|
+
"prompt": self.prompt,
|
|
26
|
+
"width": self.width,
|
|
27
|
+
"height": self.height,
|
|
28
|
+
"num_frames": self.num_frames,
|
|
29
|
+
"fps": self.fps,
|
|
30
|
+
"seed": self.seed,
|
|
31
|
+
"image_strength": self.image_strength,
|
|
32
|
+
"end_image_strength": self.end_image_strength,
|
|
33
|
+
"generate_audio": self.generate_audio,
|
|
34
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""LTX-2 video generation request model.
|
|
2
|
+
|
|
3
|
+
Text/image/audio → MP4. One endpoint serves both sync and async via ``mode``.
|
|
4
|
+
The generation mode (T2V, I2V, A2V, etc.) is inferred from which FileRef inputs
|
|
5
|
+
are present, not from a user-supplied mode field.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Literal
|
|
9
|
+
|
|
10
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
11
|
+
|
|
12
|
+
from kiapi.core.file import FileRef
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class GenerateRequest(BaseModel):
|
|
16
|
+
model_config = ConfigDict(extra="allow")
|
|
17
|
+
|
|
18
|
+
model: str | None = Field(
|
|
19
|
+
default=None,
|
|
20
|
+
description=(
|
|
21
|
+
"Model variant (see GET /v1/video/ltx2/models). Omit for the "
|
|
22
|
+
"default `distilled`; this is currently the only public variant."
|
|
23
|
+
),
|
|
24
|
+
)
|
|
25
|
+
mode: Literal["sync", "async"] = Field(
|
|
26
|
+
default="sync",
|
|
27
|
+
description=(
|
|
28
|
+
"`sync` waits for the MP4 (504 on timeout); `async` returns 202 with "
|
|
29
|
+
"a job_id immediately — poll GET /v1/jobs/{job_id}."
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
prompt: str = Field(
|
|
34
|
+
...,
|
|
35
|
+
min_length=1,
|
|
36
|
+
description=(
|
|
37
|
+
"Text description of the desired video. Distilled LTX-2 has no "
|
|
38
|
+
"negative guidance, so describe the motion, subject, framing, and "
|
|
39
|
+
"visual qualities you want rather than what to avoid."
|
|
40
|
+
),
|
|
41
|
+
examples=["a cat walking through tall grass, sunny daylight, gentle camera"],
|
|
42
|
+
)
|
|
43
|
+
image: FileRef | None = Field(
|
|
44
|
+
default=None,
|
|
45
|
+
description=(
|
|
46
|
+
"Optional first-frame conditioning image (Files-API file id, http(s) "
|
|
47
|
+
"URL, or data URL). Present with no audio => I2V; present with audio "
|
|
48
|
+
"=> A2V+I2V."
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
end_image: FileRef | None = Field(
|
|
52
|
+
default=None,
|
|
53
|
+
description=(
|
|
54
|
+
"Optional last-frame conditioning image. Use with `image` for a "
|
|
55
|
+
"first+last-frame transition, or alone for last-frame conditioning."
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
audio: FileRef | None = Field(
|
|
59
|
+
default=None,
|
|
60
|
+
description=(
|
|
61
|
+
"Optional driving audio file (Files-API file id, http(s) URL, or data "
|
|
62
|
+
"URL). When present, the mode becomes A2V and the audio is muxed into "
|
|
63
|
+
"the output MP4. Mutually exclusive with `generate_audio=true`."
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
width: int | None = Field(
|
|
67
|
+
default=None,
|
|
68
|
+
description=(
|
|
69
|
+
"Output width in pixels. Omit for server default 512. Must be a "
|
|
70
|
+
"positive multiple of 64 and no greater than the configured cap "
|
|
71
|
+
"(default 768)."
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
height: int | None = Field(
|
|
75
|
+
default=None,
|
|
76
|
+
description=(
|
|
77
|
+
"Output height in pixels. Omit for server default 512. Must be a "
|
|
78
|
+
"positive multiple of 64 and no greater than the configured cap "
|
|
79
|
+
"(default 768)."
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
num_frames: int | None = Field(
|
|
83
|
+
default=None,
|
|
84
|
+
description=(
|
|
85
|
+
"Number of output frames. Omit for server default 97. Must satisfy "
|
|
86
|
+
"`1 + 8*k` (for example 97, 161, 241, 481, 721) and stay within the "
|
|
87
|
+
"configured cap (default 721). Duration is `num_frames / fps`."
|
|
88
|
+
),
|
|
89
|
+
)
|
|
90
|
+
fps: int | None = Field(
|
|
91
|
+
default=None,
|
|
92
|
+
description=(
|
|
93
|
+
"Output frame rate. Omit for server default 24. Must be positive; it "
|
|
94
|
+
"sets playback duration but does not materially reduce generation work."
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
seed: int | None = Field(
|
|
98
|
+
default=None,
|
|
99
|
+
description=(
|
|
100
|
+
"Random seed for reproducibility. Omit for a random seed (the resolved "
|
|
101
|
+
"seed is recorded in the result `params`)."
|
|
102
|
+
),
|
|
103
|
+
)
|
|
104
|
+
image_strength: float = Field(
|
|
105
|
+
default=1.0,
|
|
106
|
+
ge=0.0,
|
|
107
|
+
le=1.0,
|
|
108
|
+
description=(
|
|
109
|
+
"First-frame conditioning strength in 0..1. 1.0 adheres tightly to "
|
|
110
|
+
"the input frame; lower values such as ~0.7 allow larger motion or "
|
|
111
|
+
"composition changes."
|
|
112
|
+
),
|
|
113
|
+
)
|
|
114
|
+
end_image_strength: float | None = Field(
|
|
115
|
+
default=None,
|
|
116
|
+
ge=0.0,
|
|
117
|
+
le=1.0,
|
|
118
|
+
description=(
|
|
119
|
+
"Last-frame conditioning strength in 0..1. Omit to let mlx-video use "
|
|
120
|
+
"its default behavior for the selected mode."
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
generate_audio: bool = Field(
|
|
124
|
+
default=False,
|
|
125
|
+
description=(
|
|
126
|
+
"Ask LTX-2 to synthesize synchronized audio for the MP4. Mutually "
|
|
127
|
+
"exclusive with an `audio` FileRef."
|
|
128
|
+
),
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
def gen_params(self) -> dict:
|
|
132
|
+
return {
|
|
133
|
+
"prompt": self.prompt,
|
|
134
|
+
"image": self.image.model_dump(mode="json")
|
|
135
|
+
if self.image is not None
|
|
136
|
+
else None,
|
|
137
|
+
"end_image": self.end_image.model_dump(mode="json")
|
|
138
|
+
if self.end_image is not None
|
|
139
|
+
else None,
|
|
140
|
+
"audio": self.audio.model_dump(mode="json")
|
|
141
|
+
if self.audio is not None
|
|
142
|
+
else None,
|
|
143
|
+
"width": self.width,
|
|
144
|
+
"height": self.height,
|
|
145
|
+
"num_frames": self.num_frames,
|
|
146
|
+
"fps": self.fps,
|
|
147
|
+
"seed": self.seed,
|
|
148
|
+
"image_strength": self.image_strength,
|
|
149
|
+
"end_image_strength": self.end_image_strength,
|
|
150
|
+
"generate_audio": self.generate_audio,
|
|
151
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# qwen
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **日本語**
|
|
4
|
+
|
|
5
|
+
[mflux Qwen Image](https://github.com/filipstrand/mflux/blob/main/src/mflux/models/qwen/README.md) で、画像生成・画像編集機能を提供します。
|
|
6
|
+
Qwen Image は多言語プロンプトと画像内テキストに強いモデルです。
|
|
7
|
+
|
|
8
|
+
- **generate**:
|
|
9
|
+
- テキストから画像を生成
|
|
10
|
+
- `init_image` FileRef を渡した場合は img2img
|
|
11
|
+
- **edit**:
|
|
12
|
+
- Files API の 1 枚以上の参照画像を使う自然言語編集
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## API
|
|
16
|
+
|
|
17
|
+
| Endpoint | Name | Description |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| `POST /v1/image/qwen/generate` | 画像生成 | プロンプトと参照画像から画像を生成。 |
|
|
20
|
+
| `POST /v1/image/qwen/edit` | 画像編集 | 複数の参照画像から画像を生成。 |
|
|
21
|
+
| `GET /v1/image/qwen/models` | モデル一覧 | 利用可能なモデルの一覧を返す。 |
|
|
22
|
+
| `GET /v1/image/qwen/openapi.json` | OpenAPI | 詳細な入出力仕様、使い方、TIPS を返す。 |
|
|
23
|
+
|
|
24
|
+
## API Docs
|
|
25
|
+
|
|
26
|
+
- [OpenAPI JSON](https://kiarina.github.io/kiapi/v1/image/qwen/openapi.json)
|
|
27
|
+
- [Swagger UI](https://kiarina.github.io/kiapi/v1/image/qwen/docs.html)
|
|
28
|
+
- [ReDoc](https://kiarina.github.io/kiapi/v1/image/qwen/redoc.html)
|
|
29
|
+
|
|
30
|
+
## Dependencies
|
|
31
|
+
|
|
32
|
+
| Package | License | Description |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| [mflux](https://github.com/filipstrand/mflux) | MIT | Qwen Image / Qwen Image Edit を MLX 上で実行。 |
|
|
35
|
+
|
|
36
|
+
## Models
|
|
37
|
+
|
|
38
|
+
| Model | License | Terms | Size | Description |
|
|
39
|
+
|---|---|---|---:|---|
|
|
40
|
+
| [Qwen/Qwen-Image](https://huggingface.co/Qwen/Qwen-Image) | Apache-2.0 | 不要 | 58 GB | `image`(デフォルト)。`generate` で使用。txt2img / img2img。既定は `steps: 30`、`guidance: 4.0`、`quantize: 8`。 |
|
|
41
|
+
| [Qwen/Qwen-Image-Edit-2509](https://huggingface.co/Qwen/Qwen-Image-Edit-2509) | Apache-2.0 | 不要 | 58 GB | `edit-2509`。`edit` で使用。単一/複数参照画像の編集。既定は `steps: 30`、`guidance: 2.5`、`quantize: 8`。 |
|
|
42
|
+
|
|
43
|
+
`POST /v1/image/qwen/generate` は `image` のみ、`POST /v1/image/qwen/edit` は
|
|
44
|
+
`edit-2509` のみを受け付けます。エンドポイントごとのデフォルトは router 側で補われる
|
|
45
|
+
ため、通常は `model` を省略できます。
|
|
46
|
+
|
|
47
|
+
## Notes
|
|
48
|
+
|
|
49
|
+
- **画像サイズ**:
|
|
50
|
+
`width` / `height` は 16 の倍数。既定は `1024 x 1024`、上限は `2048 x 2048`。
|
|
51
|
+
- **steps / guidance**:
|
|
52
|
+
`steps` は `1..100`。省略時は generate/edit とも `30`。`guidance` は generate が
|
|
53
|
+
`4.0`、edit が `2.5`。
|
|
54
|
+
- **quantize**:
|
|
55
|
+
既定は `8`。上書きする場合は `3` / `4` / `5` / `6` / `8` を指定できます。
|
|
56
|
+
省略、または `null` を渡すと既定値を使います。
|
|
57
|
+
- **LoRA 適用**:
|
|
58
|
+
`loras: [{"file": {"type": "file_id", "file_id": "..."}, "scale": 1.0}]` でアダプタを適用します。最大 4 つまで。
|
|
59
|
+
アダプタファイルは Files API に保存されている必要があります。
|
|
60
|
+
- **transient モデル**:
|
|
61
|
+
mflux は量子化レベルと LoRA をモデル構築時に固定するため、`loras` を持つ、または
|
|
62
|
+
`quantize` を既定値から上書きするリクエストは、その呼び出し用の一時モデルを構築します。
|
|
63
|
+
常駐モデルを再利用しないため、素の `image` / `edit-2509` 呼び出しより遅くなります。
|
|
64
|
+
- **出力形式**:
|
|
65
|
+
`format` は `png`(既定)/ `jpeg` / `webp`。`jpeg` / `webp` では `quality`
|
|
66
|
+
`1..100`(既定 `90`)を使います。
|
|
67
|
+
- **メモリ目安**:
|
|
68
|
+
`image` / `edit-2509` はどちらも大きなモデルです。kiapi の登録値では重み約
|
|
69
|
+
`22.0 GiB`、実行時ヘッドルーム約 `8.0 GiB` を見込んでいます。
|
|
70
|
+
|
|
71
|
+
## Quickstart
|
|
72
|
+
|
|
73
|
+
### generate - テキストから画像生成
|
|
74
|
+
|
|
75
|
+
画像だけを保存する:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
PARAMS=$(
|
|
79
|
+
jq -n \
|
|
80
|
+
--arg prompt "a cafe storefront, a wooden sign clearly reads カフェ, bright daylight" \
|
|
81
|
+
--arg negative_prompt "blurry, low quality, distorted text" \
|
|
82
|
+
'{
|
|
83
|
+
model: "image",
|
|
84
|
+
mode: "sync",
|
|
85
|
+
prompt: $prompt,
|
|
86
|
+
negative_prompt: $negative_prompt,
|
|
87
|
+
width: 512,
|
|
88
|
+
height: 512,
|
|
89
|
+
seed: 1
|
|
90
|
+
}'
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/generate \
|
|
94
|
+
-H 'Content-Type: application/json' \
|
|
95
|
+
--data-binary "$PARAMS" \
|
|
96
|
+
-o qwen.png
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Job JSON を返す:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
PARAMS=$(
|
|
103
|
+
jq -n \
|
|
104
|
+
--arg prompt "a clean product label design, the main text reads KIAPI, white background" \
|
|
105
|
+
'{
|
|
106
|
+
mode: "sync",
|
|
107
|
+
prompt: $prompt,
|
|
108
|
+
width: 512,
|
|
109
|
+
height: 512,
|
|
110
|
+
seed: 2
|
|
111
|
+
}'
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/generate \
|
|
115
|
+
-H 'Accept: application/json' \
|
|
116
|
+
-H 'Content-Type: application/json' \
|
|
117
|
+
--data-binary "$PARAMS" |
|
|
118
|
+
jq .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### generate - img2img
|
|
122
|
+
|
|
123
|
+
先にソース画像をアップロードします。
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
IMG=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
127
|
+
-F "file=@source.png" | jq -r .file_id)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
アップロードした画像を元に生成します。
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
PARAMS=$(
|
|
134
|
+
jq -n \
|
|
135
|
+
--arg img "$IMG" \
|
|
136
|
+
--arg prompt "turn this into a polished cozy illustration" \
|
|
137
|
+
'{
|
|
138
|
+
model: "image",
|
|
139
|
+
mode: "sync",
|
|
140
|
+
prompt: $prompt,
|
|
141
|
+
init_image: {type: "file_id", file_id: $img},
|
|
142
|
+
image_strength: 0.45,
|
|
143
|
+
width: 1024,
|
|
144
|
+
height: 576,
|
|
145
|
+
seed: 7
|
|
146
|
+
}'
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/generate \
|
|
150
|
+
-H 'Content-Type: application/json' \
|
|
151
|
+
--data-binary "$PARAMS" \
|
|
152
|
+
-o qwen-img2img.png
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`image_strength` は `0..1`。小さいほど入力画像を強く残し、大きいほどプロンプト側の
|
|
156
|
+
変化が強くなります。
|
|
157
|
+
|
|
158
|
+
### edit - 単一/複数画像の編集
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
REF1=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
162
|
+
-F "file=@mascot.png" | jq -r .file_id)
|
|
163
|
+
REF2=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
164
|
+
-F "file=@object.png" | jq -r .file_id)
|
|
165
|
+
|
|
166
|
+
PARAMS=$(
|
|
167
|
+
jq -n \
|
|
168
|
+
--arg ref1 "$REF1" \
|
|
169
|
+
--arg ref2 "$REF2" \
|
|
170
|
+
--arg prompt "combine the mascot and object into a bright product key visual; keep the mascot recognizable" \
|
|
171
|
+
'{
|
|
172
|
+
model: "edit-2509",
|
|
173
|
+
mode: "sync",
|
|
174
|
+
prompt: $prompt,
|
|
175
|
+
images: [{type: "file_id", file_id: $ref1}, {type: "file_id", file_id: $ref2}],
|
|
176
|
+
width: 1024,
|
|
177
|
+
height: 576,
|
|
178
|
+
seed: 9
|
|
179
|
+
}'
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/edit \
|
|
183
|
+
-H 'Content-Type: application/json' \
|
|
184
|
+
--data-binary "$PARAMS" \
|
|
185
|
+
-o qwen-edit.png
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`images` は 1 枚以上。単一画像の編集にも、複数参照画像を使った合成・再構成にも
|
|
189
|
+
使えます。
|
|
190
|
+
|
|
191
|
+
### async
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
PARAMS=$(
|
|
195
|
+
jq -n \
|
|
196
|
+
--arg prompt "a typography poster, large readable text says LOCAL AI" \
|
|
197
|
+
'{
|
|
198
|
+
mode: "async",
|
|
199
|
+
prompt: $prompt,
|
|
200
|
+
width: 512,
|
|
201
|
+
height: 512,
|
|
202
|
+
seed: 11
|
|
203
|
+
}'
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
JOB=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/generate \
|
|
207
|
+
-H 'Accept: application/json' \
|
|
208
|
+
-H 'Content-Type: application/json' \
|
|
209
|
+
--data-binary "$PARAMS" |
|
|
210
|
+
jq -r .job_id)
|
|
211
|
+
|
|
212
|
+
curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq .
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
完了後、Job の `artifacts[0]` または `result.file_id` を使って画像を取得します。
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
FID=$(curl -sS http://localhost:${PORT:-8000}/v1/jobs/$JOB | jq -r .result.file_id)
|
|
219
|
+
curl -sS http://localhost:${PORT:-8000}/v1/files/$FID/download -o qwen-async.png
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### LoRA を適用して生成
|
|
223
|
+
|
|
224
|
+
学習済みアダプタなどの `.safetensors` を Files API にアップロードし、`loras` で参照します。
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
ADAPTER=$(curl -sS -X POST http://localhost:${PORT:-8000}/v1/files \
|
|
228
|
+
-F "file=@adapter.safetensors" | jq -r .file_id)
|
|
229
|
+
|
|
230
|
+
PARAMS=$(
|
|
231
|
+
jq -n \
|
|
232
|
+
--arg adapter "$ADAPTER" \
|
|
233
|
+
--arg prompt "<your trigger word> as a clean editorial illustration" \
|
|
234
|
+
'{
|
|
235
|
+
model: "image",
|
|
236
|
+
mode: "sync",
|
|
237
|
+
prompt: $prompt,
|
|
238
|
+
width: 512,
|
|
239
|
+
height: 512,
|
|
240
|
+
seed: 13,
|
|
241
|
+
loras: [{file: {type: "file_id", file_id: $adapter}, scale: 1.0}]
|
|
242
|
+
}'
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
curl -sS -X POST http://localhost:${PORT:-8000}/v1/image/qwen/generate \
|
|
246
|
+
-H 'Content-Type: application/json' \
|
|
247
|
+
--data-binary "$PARAMS" \
|
|
248
|
+
-o qwen-lora.png
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`scale` は効きの強さです。`loras` を使うリクエストは毎回一時モデルを構築します。
|