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

# Google原生格式

> 使用 Gemini `generateContent` 调用 Google Lyria 生成音乐。

**路径：** `POST https://api.omniall.ai/v1beta/models/{model}:generateContent`

支持文生音乐、图生音乐。响应 `parts` 可能含歌词（`text`）与音频（`inlineData` Base64 MP3）。

鉴权：`Authorization: Bearer sk-...`



## OpenAPI

````yaml zh-CN/openapi/lyria-audio.yaml POST /v1beta/models/{model}:generateContent
openapi: 3.1.0
info:
  title: Omniall AI — 谷歌Lyria
  version: 1.0.0
  description: >-
    通过 Gemini 原生 `generateContent` 调用 Google Lyria 音乐生成。


    **路径：** `POST https://api.omniall.ai/v1beta/models/{model}:generateContent`


    示例模型：`lyria-3.5`、`lyria-3-clip-preview`（以[模型广场](https://omniall.ai/pricing)为准）。


    在 `generationConfig.responseModalities` 中包含 `AUDIO`（通常同时加 `TEXT` 以返回歌词）。


    鉴权：`Authorization: Bearer sk-...`
servers:
  - url: https://api.omniall.ai
security: []
paths:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - Lyria
      summary: Google原生格式
      description: >-
        使用 Gemini `generateContent` 调用 Google Lyria 生成音乐。


        **路径：** `POST
        https://api.omniall.ai/v1beta/models/{model}:generateContent`


        支持文生音乐、图生音乐。响应 `parts` 可能含歌词（`text`）与音频（`inlineData` Base64 MP3）。


        鉴权：`Authorization: Bearer sk-...`
      operationId: lyriaGenerateContent
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
            example: lyria-3.5
          description: Lyria 模型 ID。示例：`lyria-3.5`（完整歌曲）、`lyria-3-clip-preview`（约 30 秒片段）。
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
            example: Bearer sk-...
          description: Bearer API Key。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - contents
              properties:
                contents:
                  type: array
                  description: 提示轮次。纯文本为文生音乐；加入图片 `inlineData` 为图生音乐。
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        example: user
                      parts:
                        type: array
                        items:
                          type: object
                          properties:
                            text:
                              type: string
                            inlineData:
                              type: object
                              properties:
                                mimeType:
                                  type: string
                                  example: image/jpeg
                                data:
                                  type: string
                                  description: Base64 图片数据。
                generationConfig:
                  type: object
                  description: 在 `responseModalities` 中包含 `AUDIO`（以及用于歌词的 `TEXT`）。
                  properties:
                    responseModalities:
                      type: array
                      items:
                        type: string
                        enum:
                          - AUDIO
                          - TEXT
                      example:
                        - AUDIO
                        - TEXT
                    response_format:
                      type: string
                      description: 可选音频格式（如 `mp3`、`wav`，以上游支持为准）。
            examples:
              文生音乐（30 秒片段）:
                summary: 文生音乐（30 秒片段）
                value:
                  contents:
                    - role: user
                      parts:
                        - text: 创作一段 30 秒欢快原声民谣，吉他与口琴为主。
                  generationConfig:
                    responseModalities:
                      - AUDIO
                      - TEXT
              文生音乐（完整歌曲）:
                summary: 文生音乐（完整歌曲）
                value:
                  contents:
                    - role: user
                      parts:
                        - text: 创作一首约 2 分钟的电影感独立流行曲，主题是霓虹雨中漫步。包含主歌、副歌与桥段，柔和女声。
                  generationConfig:
                    responseModalities:
                      - AUDIO
                      - TEXT
              图生音乐:
                summary: 图生音乐
                value:
                  contents:
                    - role: user
                      parts:
                        - text: 根据这张情绪板图片创作配乐，保持氛围感与希望感。
                        - inlineData:
                            mimeType: image/jpeg
                            data: /9j/4AAQSkZJRgABAQAAAQABAAD...
                  generationConfig:
                    responseModalities:
                      - AUDIO
                      - TEXT
      responses:
        '200':
          description: 音乐与可选歌词
          content:
            application/json:
              schema:
                type: object
                properties:
                  candidates:
                    type: array
                    items:
                      type: object
              example:
                candidates:
                  - content:
                      parts:
                        - text: |-
                            [主歌]
                            霓虹灯下...
                        - inlineData:
                            mimeType: audio/mpeg
                            data: SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2...

````

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