> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sunra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Metinden Resme

### sunra API'sini Kullanarak Resim Üretme

sunra API'si ile resim oluşturmak için, giriş parametrelerinizi içeren belirtilen uç noktaya bir istek gönderin. API, metin tabanlı resim üretimi için önceden eğitilmiş modellerden yararlanır ve doğal dilde açıklayarak görseller üretmenizi sağlar.

İşte sunra API'sini kullanarak metinden resim üretmenin bir örneği:

<CodeGroup>
  ```javascript Javascript theme={null}
  import { sunra } from "@sunra/client";

  const result = await sunra.subscribe("black-forest-labs/flux-kontext-max/text-to-image", {
    input: {
      prompt: 'Güneşli pencere kenarında ahşap bir masa üzerinde, içinde çiçek açan çiçek çayı bulunan cam demlik, nazik sabah ışığıyla.',
      prompt_enhancer: true,
      aspect_ratio: '16:9',
      output_format: 'jpeg',
      safety_tolerance: 2
    },
    logs: true,
    onQueueUpdate: (update) => {
      console.log(update)
    },
  });
  console.log(result.data);
  console.log(result.requestId);
  ```

  ```python Python theme={null}
  import sunra_client

  result = sunra_client.subscribe(
      "black-forest-labs/flux-kontext-max/text-to-image",
      arguments={
          "prompt": "Güneşli pencere kenarında ahşap bir masa üzerinde, içinde çiçek açan çiçek çayı bulunan cam demlik, nazik sabah ışığıyla.",
          "prompt_enhancer": True,
          "aspect_ratio": "16:9",
          "output_format": "jpeg",
          "safety_tolerance": 2
      },
      with_logs=True,
      on_enqueue=print,
      on_queue_update=print,
  )
  print(result)
  ```

  ```java Java theme={null}
  import ai.sunra.client.*;
  import ai.sunra.client.queue.*;
  import java.util.Map;
  import com.google.gson.JsonObject;
  import java.util.function.Consumer;

  ClientConfig config = ClientConfig.builder()
      .withCredentials(CredentialsResolver.fromEnv())
      .build();

  SunraClient client = SunraClient.withConfig(config);
  Map<String, Object> input = Map.of(
      "prompt", "Güneşli pencere kenarında ahşap bir masa üzerinde, içinde çiçek açan çiçek çayı bulunan cam demlik, nazik sabah ışığıyla.",
      "prompt_enhancer", true,
      "aspect_ratio", "16:9",
      "output_format", "jpeg",
      "safety_tolerance", 2
  );

  Consumer<QueueStatus.StatusUpdate> statusUpdateHandler = update -> {
      String status = update.getStatus().toString();
      String message = String.format("\nDurum Güncellemesi: %s, İstek ID: %s",
          status, update.getRequestId());
      System.out.println(message);
  };

  SubscribeOptions<JsonObject> options = SubscribeOptions.<JsonObject>builder()
      .input(input)
      .resultType(JsonObject.class)
      .onQueueUpdate(statusUpdateHandler)
      .logs(true)
      .build();

  Output<JsonObject> response = client.subscribe("black-forest-labs/flux-kontext-max/text-to-image", options);
  System.out.println("Tamamlandı!");
  System.out.println(response.getData());
  ```

  ```bash Curl theme={null}
  curl --request POST \
    --url https://api.sunra.ai/v1/queue/black-forest-labs/flux-kontext-max/text-to-image \
    --header "Authorization: Key $SUNRA_KEY" \
    --header "Content-Type: application/json" \
    --data '{"prompt":"Güneşli pencere kenarında ahşap bir masa üzerinde, içinde çiçek açan çiçek çayı bulunan cam demlik, nazik sabah ışığıyla.","prompt_enhancer":true,"aspect_ratio":"16:9","output_format":"jpeg","safety_tolerance":2}'
  ```
</CodeGroup>

### Model Nasıl Seçilir

sunra çeşitli resim üretimi modelleri sağlar. İstenen stil ve kaliteye göre ihtiyaçlarınıza uygun olanı seçin.

Mevcut modeller şunları içerir:

* **[black-forest-labs/flux-kontext-pro](https://sunra.ai/models/black-forest-labs/flux-kontext-pro)**: Yerel düzenleme, üretken değişiklikler ve FLUX.1 kalitesinde metinden resme üretimi sunan birleşik bir model. Hassas bölgesel düzenlemeler veya çığır açan hızlarda tam sahne dönüşümleri için metin ve resim girişlerini işler ve karakter tutarlılığını birden fazla düzenleme turunda koruyan yinelemeli iş akışlarına öncülük eder.
* **[black-forest-labs/flux-1.1-pro](https://sunra.ai/models/black-forest-labs/flux-1.1-pro)**: FLUX'un en iyisi, birinci sınıf metin takibi, görsel kalite, resim detayı ve çıktı çeşitliliği ile çığır açan hızlarda en son teknoloji performans resim üretimi sunar.
* **[google-deepmind/imagen4](https://sunra.ai/models/google-deepmind/imagen4)**: Imagen 4, ince detay, doğru metin ve çok dilli istem desteği ile fotogerçekçi 2K resimler üretir.

Bir model seçmek için, gösterildiği gibi subscribe metodunda ID'sini belirtin. [Metinden Resme Modeller](https://sunra.ai/models?modalities%5B0%5D=modality-text-image) sayfasında daha fazla model keşfedin.
