Together AI Image Server

Together AI Image Server

site icon
2025.02.17 0
JavaScript图像生成AI 服务内容生成
Together AI Image Server 是一个基于 MCP 架构的图像生成服务,利用 Together AI 的图像生成模型来创建高质量的图像。该服务支持多种参数配置,包括图像尺寸、生成步骤、输出目录等,适用于需要快速生成图像的各种场景。
View on GitHub

Overview

基本能力

产品定位

Together AI Image Server 是一个图像生成服务,专注于通过 Together AI 的模型快速生成高质量图像。

核心功能

  • 支持 Together AI 的 FLUX.1.1-pro 模型
  • 自动调整图像尺寸(低于 256 像素时自动调整)
  • 保持图像宽高比
  • 高质量 JPEG 输出(90% 质量)
  • 递归创建输出目录
  • 返回详细的图像元数据(包括尺寸信息)

适用场景

  • 快速生成基于文本描述的图像
  • 自动化图像生成流程
  • 需要高质量图像输出的应用

工具列表

  • generate_image:生成图像的工具,支持以下参数:
  • prompt:图像的文本描述(必填)
  • model:使用的模型(默认:'black-forest-labs/FLUX.1.1-pro')
  • width:图像宽度(默认:1024)
  • height:图像高度(默认:768)
  • steps:推理步骤数(默认:28)
  • n:生成图像数量(默认:1)
  • outputDir:输出目录(默认:'./output')

常见问题解答

  • 如何获取 Together AI API Key? 从 Together AI's platform 获取。
  • 如何配置服务器? 在 Cline MCP 设置文件中添加服务器配置。

使用教程

使用依赖

  1. 安装依赖:
npm install

安装教程

  1. 构建服务器:
npm run build
  1. 配置 Together AI API Key: 在环境变量中设置 TOGETHER_API_KEY

  2. 添加服务器到 Cline MCP 设置文件: 对于 macOS/Linux:~/Library/Application Support/Windsurf/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

{
  "mcpServers": {
    "togetherai-image": {
      "command": "node",
      "args": ["/path/to/togetherai-image-server/build/index.js"],
      "env": {
        "TOGETHER_API_KEY": "your-api-key-here"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

调试方式

  1. 使用 generate_image 工具生成图像:
Generate an image of a cat and save it to my desktop:

<use_mcp_tool>
<server_name>togeherai-image</server_name>
<tool_name>generate_image</tool_name>
<arguments>
{
  "prompt": "A cute cat sitting on a windowsill",
  "outputDir": "/Users/username/Desktop/generated-images"
}
</arguments>
</use_mcp_tool>
  1. 检查输出: 工具返回 JSON 响应,包含文件路径、文件名和图像尺寸等信息。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。