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

# 音楽生成結果を取得

> PhaseoのリクエストIDを使って音楽生成結果を取得します。

`POST /music/generate`で作成した音楽結果を取得します。プロバイダー処理が完了している場合は保存済みの正規化結果を返し、ジョブが非同期処理中の場合は上流プロバイダーをポーリングします。

## レスポンスの形式

```json theme={null}
{
  "id": "req_01JY6MUSIC123",
  "object": "music",
  "status": "completed",
  "provider": "suno",
  "model": "V4_5PLUS",
  "nativeResponseId": "task_123",
  "output": [
    {
      "index": 0,
      "id": "clip_1",
      "audio_url": "https://...",
      "stream_audio_url": "https://...",
      "image_url": "https://...",
      "title": "Midnight Blue",
      "tags": "jazz, piano",
      "duration": 8
    }
  ],
  "usage": {
    "output_audio_count": 1,
    "output_audio_seconds": 8
  }
}
```

## 補足

* `status`の値: `queued`、`in_progress`、`completed`、`failed`。
* 生成が完了すると`usage`が含まれます。
* `nativeResponseId`ではなく、`POST /music/generate`が返したPhaseoの`id`を指定してください。
* プロバイダー固有の状態確認APIと取得APIは、このエンドポイントの内部で処理されます。


## OpenAPI

````yaml ja/openapi/v1/openapi.localized.yaml GET /music/generate/{music_id}
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: OpenAI互換のエンドポイントを通じて、さまざまなAIモデルにアクセスするためのゲートウェイAPI。
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: グローバルルーティング
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /music/generate/{music_id}:
    get:
      tags:
        - Gateway
      summary: 音楽生成の状態を取得
      description: >-
        POST /music/generate が返した Phaseo リクエスト ID
        を使って、正規化された音楽結果を取得します。プロバイダー固有の状態 API は内部で処理されます。
      operationId: getMusicGeneration
      parameters:
        - name: music_id
          in: path
          required: true
          description: POST /music/generate が返す安定した Phaseo リクエスト ID です。
          schema:
            type: string
      responses:
        '200':
          description: 音楽生成状態の応答
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MusicGenerateResponse'
components:
  schemas:
    MusicGenerateResponse:
      type: object
      required:
        - id
        - object
        - status
        - model
        - provider
      properties:
        id:
          type: string
          description: GET /music/generate/{music_id} で使用する、安定した Phaseo リクエスト ID です。
        object:
          type: string
          enum:
            - music
        status:
          type: string
          enum:
            - queued
            - in_progress
            - completed
            - failed
        model:
          type: string
        provider:
          type: string
        nativeResponseId:
          type: string
          nullable: true
          description: 照合およびサポートに使用する上流プロバイダーの識別子です。
        audio_url:
          type: string
          format: uri
        audio_base64:
          type: string
        result:
          description: Phaseo によって正規化されたプロバイダー結果のメタデータです。
        output:
          type: array
          items:
            type: object
            additionalProperties: true
        usage:
          type: object
          additionalProperties: true
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer トークンによる認証

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.