LTX-2.3 22B

API kılavuzu ve entegrasyon referansı: uç nokta, girdi alanları, fiyatlar, webhook ve hatalar.

Mod

Bu modelin 6 modu var; alanlar, çıktı ve fiyatlar seçili moda göredir. Modu istekte category_id ile seçin (örneklerde hazır). Göndermezseniz girdinize uyan mod, o da yoksa varsayılan mod çalışır.

İstek ve yanıt

POST
https://kolayzeka.com/api/models/ltx-23-22b/generate

Gövde: { "input": {…alanlar}, "category_id"?: sayı, "webhook_url"?: "https://…" }. Alanlar aşağıda; tanımlı olmayan bir alan 422 döner.

cURL · JSON

curl -X POST https://kolayzeka.com/api/models/ltx-23-22b/generate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "prompt": "Prompt",
    "video_url": "Video URL",
    "match_video_length": true,
    "num_frames": 121,
    "video_size": "auto",
    "generate_audio": true,
    "use_multiscale": true,
    "match_input_fps": true,
    "fps": 24,
    "num_inference_steps": 40,
    "video_cfg_scale": 3,
    "video_stg_scale": 0,
    "video_rescaling_scale": 0.7,
    "video_modality_scale": 3,
    "audio_cfg_scale": 7,
    "audio_stg_scale": 0,
    "audio_rescaling_scale": 0.7,
    "audio_modality_scale": 3,
    "gradient_estimation_gamma": 2,
    "use_restart_sampling": false,
    "scheduler": "ltx2",
    "acceleration": "regular",
    "camera_lora": "none",
    "camera_lora_scale": 1,
    "negative_prompt": "news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static",
    "enable_prompt_expansion": true,
    "enable_safety_checker": true,
    "video_output_type": "X264 (.mp4)",
    "video_quality": "high",
    "video_write_mode": "balanced",
    "distill_lora_first_pass_scale": 0.2,
    "distill_lora_second_pass_scale": 0.5,
    "video_strength": 1,
    "audio_strength": 1,
    "preprocessor": "none",
    "ic_lora_type": "union"
  },
  "category_id": 24,
  "webhook_url": "https://your-server.com/hooks/kolayzeka"
}'

cURL · multipart (dosya yükleyerek)

curl -X POST https://kolayzeka.com/api/models/ltx-23-22b/generate \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F 'input[prompt]=Prompt' \
  -F 'input[video_url]=Video URL' \
  -F 'input[match_video_length]=true' \
  -F 'input[num_frames]=121' \
  -F 'input[video_size]=auto' \
  -F 'input[generate_audio]=true' \
  -F 'input[use_multiscale]=true' \
  -F 'input[match_input_fps]=true' \
  -F 'input[fps]=24' \
  -F 'input[num_inference_steps]=40' \
  -F 'input[video_cfg_scale]=3' \
  -F 'input[video_stg_scale]=0' \
  -F 'input[video_rescaling_scale]=0.7' \
  -F 'input[video_modality_scale]=3' \
  -F 'input[audio_cfg_scale]=7' \
  -F 'input[audio_stg_scale]=0' \
  -F 'input[audio_rescaling_scale]=0.7' \
  -F 'input[audio_modality_scale]=3' \
  -F 'input[gradient_estimation_gamma]=2' \
  -F 'input[use_restart_sampling]=false' \
  -F 'input[scheduler]=ltx2' \
  -F 'input[acceleration]=regular' \
  -F 'input[camera_lora]=none' \
  -F 'input[camera_lora_scale]=1' \
  -F 'input[negative_prompt]=news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static' \
  -F 'input[enable_prompt_expansion]=true' \
  -F 'input[enable_safety_checker]=true' \
  -F 'input[video_output_type]=X264 (.mp4)' \
  -F 'input[video_quality]=high' \
  -F 'input[video_write_mode]=balanced' \
  -F 'input[distill_lora_first_pass_scale]=0.2' \
  -F 'input[distill_lora_second_pass_scale]=0.5' \
  -F 'input[video_strength]=1' \
  -F 'input[audio_strength]=1' \
  -F 'input[preprocessor]=none' \
  -F 'input[ic_lora_type]=union' \
  -F 'input[image_url]=@./image_url.jpg' \
  -F 'input[end_image_url]=@./end_image_url.jpg' \
  -F 'category_id=24' \
  -F 'webhook_url=https://your-server.com/hooks/kolayzeka'
Üretim asenkrondur. POST, 202 ve status: "queued" döner; sonuç henüz yoktur. Sonucu GET https://kolayzeka.com/api/generations/{id} ile sorgulayın ya da webhook_url verin (aynı nesne gelir). Durumlar: queued → processing → completed | failed. estimated_seconds bu modun geçmiş ortalama süresidir (null olabilir).

1 · POST yanıtı (202)

{
  "data": {
    "id": "9d1c…-uuid",
    "model": "ltx-23-22b",
    "output_type": "video",
    "source": "api",
    "status": "queued",
    "input_data": {
      "prompt": "Prompt",
      "video_url": "Video URL",
      "match_video_length": true,
      "num_frames": 121,
      "video_size": "auto",
      "generate_audio": true,
      "use_multiscale": true,
      "match_input_fps": true,
      "fps": 24,
      "num_inference_steps": 40,
      "video_cfg_scale": 3,
      "video_stg_scale": 0,
      "video_rescaling_scale": 0.7,
      "video_modality_scale": 3,
      "audio_cfg_scale": 7,
      "audio_stg_scale": 0,
      "audio_rescaling_scale": 0.7,
      "audio_modality_scale": 3,
      "gradient_estimation_gamma": 2,
      "use_restart_sampling": false,
      "scheduler": "ltx2",
      "acceleration": "regular",
      "camera_lora": "none",
      "camera_lora_scale": 1,
      "negative_prompt": "news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static",
      "enable_prompt_expansion": true,
      "enable_safety_checker": true,
      "video_output_type": "X264 (.mp4)",
      "video_quality": "high",
      "video_write_mode": "balanced",
      "distill_lora_first_pass_scale": 0.2,
      "distill_lora_second_pass_scale": 0.5,
      "video_strength": 1,
      "audio_strength": 1,
      "preprocessor": "none",
      "ic_lora_type": "union"
    },
    "output_data": null,
    "thumbnail_url": null,
    "credit_cost": 1438,
    "duration": null,
    "estimated_seconds": 12,
    "error_message": null,
    "webhook_url": "https://your-server.com/hooks/kolayzeka",
    "created_at": "2026-06-29T12:00:00.000000Z",
    "updated_at": "2026-06-29T12:00:00.000000Z"
  },
  "success": true
}

2 · Tamamlandı (GET /generations/{id} veya webhook)

{
  "data": {
    "id": "9d1c…-uuid",
    "model": "ltx-23-22b",
    "output_type": "video",
    "source": "api",
    "status": "completed",
    "input_data": {
      "prompt": "Prompt",
      "video_url": "Video URL",
      "match_video_length": true,
      "num_frames": 121,
      "video_size": "auto",
      "generate_audio": true,
      "use_multiscale": true,
      "match_input_fps": true,
      "fps": 24,
      "num_inference_steps": 40,
      "video_cfg_scale": 3,
      "video_stg_scale": 0,
      "video_rescaling_scale": 0.7,
      "video_modality_scale": 3,
      "audio_cfg_scale": 7,
      "audio_stg_scale": 0,
      "audio_rescaling_scale": 0.7,
      "audio_modality_scale": 3,
      "gradient_estimation_gamma": 2,
      "use_restart_sampling": false,
      "scheduler": "ltx2",
      "acceleration": "regular",
      "camera_lora": "none",
      "camera_lora_scale": 1,
      "negative_prompt": "news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static",
      "enable_prompt_expansion": true,
      "enable_safety_checker": true,
      "video_output_type": "X264 (.mp4)",
      "video_quality": "high",
      "video_write_mode": "balanced",
      "distill_lora_first_pass_scale": 0.2,
      "distill_lora_second_pass_scale": 0.5,
      "video_strength": 1,
      "audio_strength": 1,
      "preprocessor": "none",
      "ic_lora_type": "union"
    },
    "output_data": {
      "result": "https://<signed-url>/output.mp4"
    },
    "thumbnail_url": "https://<signed-url>/thumb.jpg",
    "credit_cost": 1438,
    "duration": 4.52,
    "estimated_seconds": 12,
    "error_message": null,
    "webhook_url": "https://your-server.com/hooks/kolayzeka",
    "created_at": "2026-06-29T12:00:00.000000Z",
    "updated_at": "2026-06-29T12:00:05.000000Z"
  },
  "success": true
}

3 · Başarısız

{
  "data": {
    "id": "9d1c…-uuid",
    "model": "ltx-23-22b",
    "output_type": "video",
    "source": "api",
    "status": "failed",
    "input_data": {
      "prompt": "Prompt",
      "video_url": "Video URL",
      "match_video_length": true,
      "num_frames": 121,
      "video_size": "auto",
      "generate_audio": true,
      "use_multiscale": true,
      "match_input_fps": true,
      "fps": 24,
      "num_inference_steps": 40,
      "video_cfg_scale": 3,
      "video_stg_scale": 0,
      "video_rescaling_scale": 0.7,
      "video_modality_scale": 3,
      "audio_cfg_scale": 7,
      "audio_stg_scale": 0,
      "audio_rescaling_scale": 0.7,
      "audio_modality_scale": 3,
      "gradient_estimation_gamma": 2,
      "use_restart_sampling": false,
      "scheduler": "ltx2",
      "acceleration": "regular",
      "camera_lora": "none",
      "camera_lora_scale": 1,
      "negative_prompt": "news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static",
      "enable_prompt_expansion": true,
      "enable_safety_checker": true,
      "video_output_type": "X264 (.mp4)",
      "video_quality": "high",
      "video_write_mode": "balanced",
      "distill_lora_first_pass_scale": 0.2,
      "distill_lora_second_pass_scale": 0.5,
      "video_strength": 1,
      "audio_strength": 1,
      "preprocessor": "none",
      "ic_lora_type": "union"
    },
    "output_data": null,
    "thumbnail_url": null,
    "credit_cost": 0,
    "duration": null,
    "estimated_seconds": 12,
    "error_message": "Sağlayıcı yoğun, lütfen tekrar deneyin.",
    "webhook_url": "https://your-server.com/hooks/kolayzeka",
    "created_at": "2026-06-29T12:00:00.000000Z",
    "updated_at": "2026-06-29T12:00:00.000000Z"
  },
  "success": true
}
  • Sonuç output_data.result alanındadır (imzalı URL, süreli: kalıcı tutmak için kendi depolamanıza indirin).
  • Medya URL'leri imzalıdır ve süresi dolar; eski bir URL için işi tekrar GET edin, taze URL gelir.
  • Geçmiş: GET https://kolayzeka.com/api/generations (en yeni önce, sayfa başına 20, ?page=).

Fiyat ve teklif

Fiyat kredi cinsindendir ve seçtiğiniz seçeneklere (kalite, boyut, süre, adet…) göre değişir. Varsayılan ayarlarla bu mod ≈ 1438 kredi.

POST
https://kolayzeka.com/api/models/ltx-23-22b/quote

Çalıştırmadan, tam bu girdinin fiyatı. Token gerekmez; girdiyi üretimdeki gibi doğrular.

cURL

curl -X POST https://kolayzeka.com/api/models/ltx-23-22b/quote \
  -H "Content-Type: application/json" \
  -d '{"input":{"prompt":"Prompt","video_url":"Video URL","match_video_length":true,"num_frames":121,"video_size":"auto","generate_audio":true,"use_multiscale":true,"match_input_fps":true,"fps":24,"num_inference_steps":40,"video_cfg_scale":3,"video_stg_scale":0,"video_rescaling_scale":0.7,"video_modality_scale":3,"audio_cfg_scale":7,"audio_stg_scale":0,"audio_rescaling_scale":0.7,"audio_modality_scale":3,"gradient_estimation_gamma":2,"use_restart_sampling":false,"scheduler":"ltx2","acceleration":"regular","camera_lora":"none","camera_lora_scale":1,"negative_prompt":"news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static","enable_prompt_expansion":true,"enable_safety_checker":true,"video_output_type":"X264 (.mp4)","video_quality":"high","video_write_mode":"balanced","distill_lora_first_pass_scale":0.2,"distill_lora_second_pass_scale":0.5,"video_strength":1,"audio_strength":1,"preprocessor":"none","ic_lora_type":"union"},"category_id":24}'

Yanıt

{
  "success": true,
  "data": {
    "credits": 1438,
    "basis": "per_generation",
    "exact": true,
    "mode": {
      "category_id": 24,
      "label": "Video to Video"
    }
  }
}
  • exact: false: fiyat çıktıya bağlı (ör. token, gerçek süre); teklif tipik değerle hesaplanır.
  • Kredi, istek kabul edilince teklif tutarı kadar ayrılır. İş bitince gerçek tutara göre fark düşülür ya da iade edilir; iş başarısız olursa tamamı iade edilir. Kesin tutar: sonuçtaki credit_cost.
  • Bakiye: GET https://kolayzeka.com/api/me → credit_balance. Yetmezse 402 insufficient_credits.

Girdi alanları

input içine gönderilir. Tip etiketi gönderilecek JSON değeridir (string, integer, number, boolean, url, array<url>). Aynı liste makine-okunur olarak GET https://kolayzeka.com/api/ai-models/ltx-23-22b yanıtında.

prompt
zorunlu
string

Prompt · The prompt to generate the video from.

video_url
zorunlu
string

Video URL · The URL of the video to reference.

audio_url
isteğe bağlı
string

Audio URL · An optional URL of an audio to use as the audio for the video. If not provided, any audio present in the input video will be used.

image_url
isteğe bağlı
url
dosya

Image URL · An optional URL of an image to use as the first frame of the video.

JSON'da herkese açık bir https URL gönderin, ya da dosyayı multipart ile yükleyin: -F 'input[image_url]=@./dosya.jpg'

end_image_url
isteğe bağlı
url
dosya

End Image URL · The URL of the image to use as the end of the video.

JSON'da herkese açık bir https URL gönderin, ya da dosyayı multipart ile yükleyin: -F 'input[end_image_url]=@./dosya.jpg'

match_video_length
isteğe bağlı
boolean

Match Video Length · When enabled, the number of frames will be calculated based on the video duration and FPS. When disabled, use the specified num_frames.

Varsayılan: true (gönderilmezse bu kullanılır)

num_frames
isteğe bağlı
number

Number of Frames · The number of frames to generate.

Varsayılan: 121 (gönderilmezse bu kullanılır)

Sınırlar: en az 9 · en çok 481

video_size
isteğe bağlı
string

Video Size · The size of the generated video.

Kabul edilen değerler:"auto""square_hd""square""portrait_4_3""portrait_16_9""landscape_4_3""landscape_16_9"

Varsayılan: "auto" (gönderilmezse bu kullanılır)

generate_audio
isteğe bağlı
boolean

Generate Audio · Whether to generate audio for the video.

Varsayılan: true (gönderilmezse bu kullanılır)

use_multiscale
isteğe bağlı
boolean

Use Multi-Scale · Whether to use multi-scale generation. If True, the model will generate the video at a smaller scale first, then use the smaller video to guide the generation of a video at or above your requested size. This results in better coherence and details.

Varsayılan: true (gönderilmezse bu kullanılır)

match_input_fps
isteğe bağlı
boolean

Match Input FPS · When true, match the output FPS to the input video's FPS instead of using the default target FPS.

Varsayılan: true (gönderilmezse bu kullanılır)

fps
isteğe bağlı
number

FPS · The frames per second of the generated video.

Varsayılan: 24 (gönderilmezse bu kullanılır)

Sınırlar: en az 1 · en çok 60

num_inference_steps
isteğe bağlı
number

Number of Inference Steps · The number of inference steps to use.

Varsayılan: 40 (gönderilmezse bu kullanılır)

Sınırlar: en az 8 · en çok 50

video_cfg_scale
isteğe bağlı
number

Video CFG Scale · The Classifier-Free Guidance (CFG) scale for the video. Higher values result in more consistent and focused video content.

Varsayılan: 3 (gönderilmezse bu kullanılır)

Sınırlar: en az 1 · en çok 20

video_stg_scale
isteğe bağlı
number

Video STG Scale · The Spatiotemporal Guidance (STG) scale for the video. Higher values result in more consistent and focused video content.

Varsayılan: 0 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 20

video_rescaling_scale
isteğe bağlı
number

Video Rescaling Scale · The rescaling scale for the video. Controls the ratio between classifier-free guidance and spatiotemporal guidance.

Varsayılan: 0.7 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

video_modality_scale
isteğe bağlı
number

Video Modality Scale · The modality scale for the video. Controls the ratio between video and audio modalities.

Varsayılan: 3 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 10

audio_cfg_scale
isteğe bağlı
number

Audio CFG Scale · The Classifier-Free Guidance (CFG) scale for the audio. Higher values result in more consistent and focused audio content.

Varsayılan: 7 (gönderilmezse bu kullanılır)

Sınırlar: en az 1 · en çok 20

audio_stg_scale
isteğe bağlı
number

Audio STG Scale · The Spatiotemporal Guidance (STG) scale for the audio. Higher values result in more consistent and focused audio content.

Varsayılan: 0 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 20

audio_rescaling_scale
isteğe bağlı
number

Audio Rescaling Scale · The rescaling scale for the audio. Controls the ratio between classifier-free guidance and spatiotemporal guidance.

Varsayılan: 0.7 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

audio_modality_scale
isteğe bağlı
number

Audio Modality Scale · The modality scale for the audio. Controls the ratio between video and audio modalities.

Varsayılan: 3 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 10

gradient_estimation_gamma
isteğe bağlı
number

Gradient Estimation Gamma · The gamma of gradient estimation during denoising. Set to 0 to disable.

Varsayılan: 2 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 10

use_restart_sampling
isteğe bağlı
boolean

Use Restart Sampling · Whether to use restart sampling. This will inject a small amount of noise during each denoising step, which can help improve the quality of the generated video.

Varsayılan: false (gönderilmezse bu kullanılır)

scheduler
isteğe bağlı
string

Scheduler · The scheduler to use.

Kabul edilen değerler:"ltx2""linear_quadratic""beta"

Varsayılan: "ltx2" (gönderilmezse bu kullanılır)

acceleration
isteğe bağlı
string

Acceleration · The acceleration level to use.

Kabul edilen değerler:"none""regular""high""full"

Varsayılan: "regular" (gönderilmezse bu kullanılır)

camera_lora
isteğe bağlı
string

Camera LoRA · The camera LoRA to use. This allows you to control the camera movement of the generated video more accurately than just prompting the model to move the camera.

Kabul edilen değerler:"dolly_in""dolly_out""dolly_left""dolly_right""jib_up""jib_down""static""none"

Varsayılan: "none" (gönderilmezse bu kullanılır)

camera_lora_scale
isteğe bağlı
number

Camera LoRA Scale · The scale of the camera LoRA to use. This allows you to control the camera movement of the generated video more accurately than just prompting the model to move the camera.

Varsayılan: 1 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

negative_prompt
isteğe bağlı
string

Negative Prompt · The negative prompt to generate the video from.

Varsayılan: "news broadcast, 3d animation, computer graphics, pc game, console game, video game, cartoon, childish, watermark, logo, text, on screen text, subtitles, titles, signature, slowmo, static" (gönderilmezse bu kullanılır)

seed
isteğe bağlı
number

Seed · The seed for the random number generator.

enable_prompt_expansion
isteğe bağlı
boolean

Enable Prompt Expansion · Whether to enable prompt expansion.

Varsayılan: true (gönderilmezse bu kullanılır)

enable_safety_checker
isteğe bağlı
boolean

Enable Safety Checker · Whether to enable the safety checker.

Varsayılan: true (gönderilmezse bu kullanılır)

video_output_type
isteğe bağlı
string

Video Output Type · The output type of the generated video.

Kabul edilen değerler:"X264 (.mp4)""VP9 (.webm)""PRORES4444 (.mov)""GIF (.gif)"

Varsayılan: "X264 (.mp4)" (gönderilmezse bu kullanılır)

video_quality
isteğe bağlı
string

Video Quality · The quality of the generated video.

Kabul edilen değerler:"low""medium""high""maximum"

Varsayılan: "high" (gönderilmezse bu kullanılır)

video_write_mode
isteğe bağlı
string

Video Write Mode · The write mode of the generated video.

Kabul edilen değerler:"fast""balanced""small"

Varsayılan: "balanced" (gönderilmezse bu kullanılır)

distill_lora_first_pass_scale
isteğe bağlı
number

Distill Lora First Pass Scale · The scale of the distill LoRA to use for the first pass. Set to 0 to disable.

Varsayılan: 0.2 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

distill_lora_second_pass_scale
isteğe bağlı
number

Distill Lora Second Pass Scale · The scale of the distill LoRA to use for the second and subsequent passes.

Varsayılan: 0.5 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

video_strength
isteğe bağlı
number

Video Strength · Video conditioning strength. Lower values represent more freedom given to the model to change the video content.

Varsayılan: 1 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

audio_strength
isteğe bağlı
number

Audio Strength · Audio conditioning strength. Lower values represent more freedom given to the model to change the audio content.

Varsayılan: 1 (gönderilmezse bu kullanılır)

Sınırlar: en az 0 · en çok 1

preprocessor
isteğe bağlı
string

Preprocessor · The preprocessor to use for the generation.

Kabul edilen değerler:"depth""canny""pose""none"

Varsayılan: "none" (gönderilmezse bu kullanılır)

ic_lora_type
isteğe bağlı
string

IC-LoRA Type · The IC LoRA type to use for the generation.

Kabul edilen değerler:"match_preprocessor""union""detailer""none"

Varsayılan: "union" (gönderilmezse bu kullanılır)

Kimlik doğrulama

Her istekte Authorization: Bearer YOUR_API_TOKEN. Token'ı Profil sayfasında oluşturun. Katalog ve teklif (/ai-models, /quote) token istemez. Ayrıntılar: geliştirici rehberi.

Webhook

İsteğe bir webhook_url (https) ekleyin; iş bitince oraya imzalı bir POST gelir. Gövde { event, success, data }: data, durum endpoint'inin döndüğü nesnenin aynısıdır. Sorgulamaya gerek kalmaz; uzun işler (video, çok adımlı uygulamalar) için önerilir.

Gelen başlıklar

X-KolayZeka-Event: generation.completed // veya generation.failed

X-KolayZeka-Signature: sha256=<hex>

User-Agent: KolayZeka-Webhook/1.0

İmza = ham gövdenin, hesabınızın webhook imzalama anahtarı ile HMAC-SHA256'sı. Anahtarı Profil sayfasında oluşturun (bir kez gösterilir). Anahtar yoksa webhook gönderilmez.

Doğrulama · Node.js

import crypto from 'node:crypto';

// rawBody: the request body exactly as received (before JSON.parse).
const expected = 'sha256=' + crypto
  .createHmac('sha256', process.env.KOLAYZEKA_WEBHOOK_SECRET)
  .update(rawBody)
  .digest('hex');
const given = req.headers['x-kolayzeka-signature'] ?? '';

if (given.length !== expected.length ||
    !crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(given))) {
  return res.status(401).end();
}

Doğrulama · PHP / Laravel

$expected = 'sha256='.hash_hmac('sha256', $request->getContent(), config('services.kolayzeka.webhook_secret'));

abort_unless(hash_equals($expected, (string) $request->header('X-KolayZeka-Signature')), 401);
  • 2xx dönün. Diğer yanıtlar ve ağ hataları 30 sn arayla en çok 5 kez yeniden denenir.
  • Aynı iş için birden fazla gelebilir: data.id ile tekilleştirin.
  • Özel / iç ağ / bulut-metadata adresleri reddedilir (422 invalid_webhook_url).

Hatalar

Her hata aynı şekildedir: { success: false, code, error, … }. Kodunuzu code'a göre yazın; error insan için mesajdır.

HTTPcodeNe zaman
400
invalid_modeModelin şu an çalıştırılabilir bir modu yok (geçici; başka model deneyin).
401
unauthenticatedBearer token yok, geçersiz ya da iptal edilmiş.
402
insufficient_creditsBakiye yetmiyor. Yanıtta balance (bakiye) ve required (gereken) var.
403
forbiddenBu kaynağa erişim yetkiniz yok.
404
not_foundModel / uygulama / iş yok, aktif değil ya da size ait değil.
405
method_not_allowedEndpoint bu HTTP metodunu kabul etmiyor.
422
validation_failedGirdi şemaya uymuyor. errors alanı: alan → mesajlar.
422
invalid_webhook_urlwebhook_url https değil, çözümlenmiyor ya da özel / iç ağ adresi.
429
rate_limitedHız sınırı aşıldı. retry_after saniye sonra tekrar deneyin.
500
server_errorBeklenmeyen hata. Tekrar denemeden önce listeden (GET /api/generations) işin oluşup oluşmadığına bakın.

402 örneği

{
  "success": false,
  "code": "insufficient_credits",
  "error": "Yetersiz kredi. Bakiye: 40, Gerekli: 55",
  "balance": 40,
  "required": 55
}

422 örneği

{
  "success": false,
  "code": "validation_failed",
  "error": "Doğrulama başarısız oldu.",
  "errors": {
    "quality": [
      "`quality` alanı şunlardan biri olmalıdır: low, medium, high."
    ]
  }
}