İçeriğe geç
API Referansı
API Referansı

Producer Metinden Müziğe

Asenkron bir Görev oluşturmak için metinden müziğe uç noktasını kullanın.

01

Genel Bakış

Metinden müziğe uç noktasını desteklenen bir modelle kullanın. Durumunu almak için döndürülen Görev Kimliğini kullanın veya aşağıda belgelenen teslimler için callback_url sağlayın.

Hızlı başlangıç

  1. Bir API anahtarı oluşturun ve RUNAPI_API_KEY olarak ayarlayın.
  2. Desteklenen bir model seçin ve gövdesi o modelin şemasıyla eşleşen bir POST isteği gönderin.
  3. Döndürülen görev kimliğini saklayın, ardından bir terminal durumuna ulaşana kadar yoklama yapın ya da aşağıda belgelenen geri çağırmaları işleyin.

Uç Nokta

POST /api/v1/producer/text_to_music
Temel URL
https://runapi.ai
API sürümü
v1
Kimlik doğrulama
Authorization: Bearer YOUR_API_TOKEN
02

Desteklenen modeller

Güncel fiyatlandırma, hız sınırları ve ticari kullanım ayrıntıları için bir model sayfası açın.

03

İstek şeması

JSON gövdesi

Alanlar ve izin verilen değerler seçili modele göre değişir. Sağlandığında, callback_url aşağıda belgelenen Görev teslimatlarını alır.

fuzz-0.86 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-1.06 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-1.0-pro6 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-1.16 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-1.1-pro6 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-2.06 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-2.0-pro6 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental
fuzz-2.0-raw6 alan
callback_urlstring
İsteğe bağlı

Asenkron bildirimler için webhook URL'si.

lyricsstring
İsteğe bağlı

Söylenecek tam şarkı sözleri.

modelstring
Zorunlu

Model tanımlayıcısı.

promptstring
Zorunlu

Müzik tarzı ve prodüksiyon özeti.

Aralık: 1 - 200
titlestring
İsteğe bağlı

Müzik başlığı.

vocal_modestring
Zorunlu

Vokal oluşturma modu.

İzin verilen değerler: exact_lyrics, instrumental

Koşullu kurallar

Bu gereksinimler, listelenen tüm koşulların eşleştiği durumlarda uygulanır.

  1. Şu durumlarda vocal_mode = exact_lyrics
    Gerekli
    lyrics
    Kabul edilmez
  2. Şu durumlarda vocal_mode = instrumental
    Gerekli
    Kabul edilmez
    lyrics
04

Kabul oluştur

HTTP 202

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
05

Yoklama işleniyor

HTTP 200

GET /api/v1/producer/text_to_music/:id

Yanıt şeması
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "id": "tsk_reference_demo",
  "status": "processing"
}
06

Yoklama tamamlandı

HTTP 200

GET /api/v1/producer/text_to_music/:id

Yanıt şeması
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "audio_url",
          "model_name"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "generation_stage": {
      "enum": [
        "all_audios_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "generation_stage",
    "audios",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "duration_seconds": 78.36,
      "id": "audio_reference",
      "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
      "lyrics": "[Instrumental]",
      "model_name": "fuzz-2.0",
      "title": "Soft Piano"
    }
  ],
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "generation_stage": "all_audios_ready",
  "id": "tsk_reference_demo",
  "status": "completed"
}
07

Yoklama başarısız oldu

HTTP 200

GET /api/v1/producer/text_to_music/:id

Yanıt şeması
JSON
{
  "properties": {
    "billing": {
      "properties": {
        "refund": {
          "oneOf": [
            {
              "properties": {
                "refunded_at": {
                  "type": "string"
                }
              },
              "required": [
                "refunded_at"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "reservation": {
          "oneOf": [
            {
              "properties": {
                "amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "amount_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        },
        "settlement": {
          "oneOf": [
            {
              "properties": {
                "amount_micro_cents": {
                  "type": "integer"
                },
                "charged_amount_cents": {
                  "type": "integer"
                }
              },
              "required": [
                "charged_amount_cents",
                "amount_micro_cents"
              ],
              "type": "object",
              "unevaluatedProperties": false
            },
            {
              "enum": [
                null
              ]
            }
          ]
        }
      },
      "required": [
        "reservation",
        "settlement",
        "refund"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "error": {
      "type": "string"
    },
    "generation_stage": {
      "enum": [
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "generation_stage",
    "billing"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "billing": {
    "refund": null,
    "reservation": null,
    "settlement": null
  },
  "error": "Task processing failed.",
  "generation_stage": "failed",
  "id": "tsk_reference_demo",
  "status": "failed"
}
08

Müşteri geri çağırması: tamamlandı

HTTP 200

POST callback_url

Yanıt şeması
JSON
{
  "properties": {
    "audios": {
      "items": {
        "properties": {
          "audio_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "duration_seconds": {
            "type": "number"
          },
          "id": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "x-runapi-generated-media": true
          },
          "lyrics": {
            "type": "string"
          },
          "model_name": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "audio_url",
          "model_name"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    },
    "generation_stage": {
      "enum": [
        "all_audios_ready"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "generation_stage",
    "audios"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "audios": [
    {
      "audio_url": "https://file.runapi.ai/reference-audio.mp3",
      "duration_seconds": 78.36,
      "id": "audio_reference",
      "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
      "lyrics": "[Instrumental]",
      "model_name": "fuzz-2.0",
      "title": "Soft Piano"
    }
  ],
  "generation_stage": "all_audios_ready",
  "id": "tsk_reference_demo",
  "status": "completed"
}
09

Müşteri geri çağırması: başarısız oldu

HTTP 200

POST callback_url

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "generation_stage": {
      "enum": [
        "failed"
      ],
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error",
    "generation_stage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "generation_stage": "failed",
  "id": "tsk_reference_demo",
  "status": "failed"
}
10

Hatalar

HTTP 401

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Authentication required"
}
11

Hatalar

HTTP 401

GET /api/v1/producer/text_to_music/:id

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Authentication required"
}
12

Hatalar

HTTP 400

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "İnsan tarafından okunabilir hata mesajı.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "İnsan tarafından okunabilir doğrulama özeti.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Herkese açık istek alanına göre anahtarlanan doğrulama mesajları; her alan için insan tarafından okunabilir dizelerden oluşan bir dizi içerir.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

Yanıt örneği

JSON
{
  "error": "model must be one of: fuzz-0.8, fuzz-1.0, fuzz-1.0-pro, fuzz-1.1, fuzz-1.1-pro, fuzz-2.0, fuzz-2.0-pro, fuzz-2.0-raw"
}
13

Hatalar

HTTP 402

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Insufficient balance"
}
14

Hatalar

HTTP 429

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "API key credit limit exceeded"
}
15

Hatalar

HTTP 409

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "The request uses features that are not supported for the selected model"
}
16

Hatalar

HTTP 429

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Rate limit reached. Please retry later."
}
17

Hatalar

HTTP 503

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Service under maintenance, please try again later"
}
18

Hatalar

HTTP 504

POST /api/v1/producer/text_to_music

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "The request timed out"
}
19

Hatalar

HTTP 404

GET /api/v1/producer/text_to_music/:id

Yanıt şeması
JSON
{
  "properties": {
    "error": {
      "description": "İnsan tarafından okunabilir hata mesajı.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Yanıt örneği

JSON
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
20

Oluşturulan Kod Örnekleri

Doğrudan cURL kullanın veya diliniz için bir SDK yükleyin. Her örnek, bu başvuruda gösterilen doğrulanmış isteği gönderir.

Yükle

Shell
pip install runapi-producer
PYTHON
import os
from runapi.producer import ProducerClient

client = ProducerClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_music.create(
  model="fuzz-2.0",
  vocal_mode="instrumental",
  prompt="Soft piano with gentle percussion."
)