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

# Banana Lite

> 轻量级 Banana 模型，支持文生图和图生图，适合快速生成场景

Banana Lite 是 Banana 官方模型的轻量版本，生成速度更快，适合快速迭代和批量处理场景。

## 文生图

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.eztokens.ai/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $EZTOKENS_API_KEY" \
      -d '{
        "model": "banana-lite",
        "messages": [{
          "role": "user",
          "content": "A minimalist logo design for a tech startup"
        }],
        "max_tokens": 1000
      }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(
        api_key="EZTOKENS_API_KEY",
        base_url="https://api.eztokens.ai/v1"
    )

    response = client.chat.completions.create(
        model="banana-lite",
        messages=[{
            "role": "user",
            "content": "A minimalist logo design for a tech startup"
        }],
        max_tokens=1000
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    import OpenAI from "openai";

    const client = new OpenAI({
      apiKey: "EZTOKENS_API_KEY",
      baseURL: "https://api.eztokens.ai/v1",
    });

    const response = await client.chat.completions.create({
      model: "banana-lite",
      messages: [{
        role: "user",
        content: "A minimalist logo design for a tech startup"
      }],
      max_tokens: 1000,
    });

    console.log(response.choices[0].message.content);
    ```
  </Tab>
</Tabs>

## 图生图

传入参考图片进行风格迁移或增强：

```python theme={null}
# 图片 URL
response = client.chat.completions.create(
    model="banana-lite",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Turn this photo into a Studio Ghibli style illustration"},
            {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
        ]
    }],
    max_tokens=1000
)
```

```python theme={null}
# Base64
import base64

with open("input.jpg", "rb") as f:
    encoded = base64.b64encode(f.read()).decode("utf-8")

response = client.chat.completions.create(
    model="banana-lite",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Apply pixel art style"},
            {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{encoded}"}}
        ]
    }],
    max_tokens=1000
)
```

## 分辨率与尺寸

| 分辨率         | 宽高比     | 适用场景      |
| ----------- | ------- | --------- |
| `1024x1024` | 1:1 正方形 | 头像、图标     |
| `1024x1792` | 9:16 竖版 | 手机壁纸、竖版海报 |
| `1792x1024` | 16:9 横版 | 桌面壁纸、横版横幅 |

## 配置参数

| 参数           | 类型      | 必需 | 说明                                           |
| ------------ | ------- | -- | -------------------------------------------- |
| `model`      | string  | 是  | 模型名称，使用 `banana-lite`                        |
| `messages`   | array   | 是  | 消息数组，文生图传文字描述，图生图传入参考图                       |
| `max_tokens` | integer | 否  | 生成图像的最大 Token 数，默认 1000                      |
| `size`       | string  | 否  | 输出分辨率，可选 `1024x1024`、`1024x1792`、`1792x1024` |
| `quality`    | string  | 否  | 图像质量，可选 `standard`（默认）或 `hd`                 |
| `style`      | string  | 否  | 风格模式，可选 `vivid`（生动）或 `natural`（自然）           |
| `n`          | integer | 否  | 生成图片数量，默认为 1                                 |

<Note>
  Banana Lite 提供更低的 Token 消耗和更快的响应速度，适合批量处理和高频调用。
</Note>
