内容
<div align="center">
<img src="assets/logo.png" alt="Createya" width="320"/>
# Createya MCP & API
### 无边界的神经网络世界。
#### 通过 MCP 或 REST。100+ 模型。一个密钥。
[](https://modelcontextprotocol.io/)
[](https://api.createya.ai/v1/openapi.json)
[](LICENSE)
[]()
[](docs/models-image.md)
[🚀 快速开始](#-60) · [🤖 MCP](#-mcp) · [📡 REST](#-rest) · [🎨 模型](#-模型目录) · [⚙️ 连接](#%EF%B8%8F-连接) · [🏢 企业](#-企业) · [💬 支持](#-联系)
---
**连接 Createya 的神经网络到您的 AI 代理或代码中,通过 MCP 或 REST。启动时免费获得 100 个积分。**
**两种方式任您选择:**
- 🤖 **MCP** — 适用于 AI 代理(Claude, Cursor, Cline, Windsurf, Codex, OpenCode)。一个 URL,OAuth 或 Bearer — 代理商自己看到模型目录。
- 📡 **REST** — 适用于您的代码。一个 Bearer 令牌,`POST /v1/run`,以及 curl / Python / Node.js / Go 的现成示例。
</div>
---
## 🎯 为什么需要它
AI 代理时代已经到来。Claude, Cursor, Cline, OpenCode, Codex — 每个星期都会出现一个新的代理框架。它们都通过 **MCP** (Model Context Protocol)工作 — Anthropic 的开放标准,用于连接外部工具。
Createya 解决了 4 个常见问题:
| 问题 | Createya 的解决方案 |
|---|---|
| 地理限制,需要 VPN | 直接访问 — 不需要 VPN |
| 国外卡不被接受 | 俄罗斯卡,SBi,T-Pay — 卢布支付 |
| 多个服务,不同密钥 | 通过 **一个 API 密钥** 的模型目录 |
| 本地数据存储(152-ФЗ) | 所有数据都存储在本地,完全符合法律要求 |
| 企业和 B2B | 合同,发票,法案。按非现金结算,含增值税 |
所有这些都可以通过 **MCP** (适用于代理)或普通的 **REST** (适用于您的代码)。
---
## ⚡ 60 秒快速开始
**1. 注册 → 获取 100 个免费积分**
[createya.ai](https://createya.ai)
**2. 创建 API 密钥** (格式 `crya_sk_<32hex>`)
[createya.ai/settings/api-keys](https://createya.ai/settings/api-keys)
**3. 接下来,选择您的路径:**
### 🤖 如果您正在构建 AI 代理 → 一条命令
```bash
curl -fsSL https://api.createya.ai/install | bash -s -- crya_sk_YOUR_KEY
```
安装 MCP 服务器 + 技能。自动检测:Claude Code (`~/.claude/skills/`),opencode (读取相同),Codex CLI / Cursor / OpenClaw (通用路径 `~/.agents/skills/`,符合 [agentskills.io](https://agentskills.io) 标准)。
所有存储库中的技能都自动安装 — 添加新的 = 下次出现。实用标志:
```bash
# 查看可用技能:
curl -fsSL https://api.createya.ai/install | bash -s -- --list
# 安装特定技能:
curl -fsSL https://api.createya.ai/install | bash -s -- crya_sk_KEY --skills creative-director
```
[→ 所有客户端的说明](#%EF%B8%8F-连接)
### 💻 如果您编写自己的代码 → REST
```bash
curl -X POST https://api.createya.ai/v1/run \
-H "Authorization: Bearer crya_sk_..." \
-H "Content-Type: application/json" \
-d '{"model":"nano-banana-2","input":{"prompt":"猫在月球上"}}'
```
[→ curl / Python / Node.js / Go 的完整示例](#-rest)
> 💡 **启动时免费获得 100 个积分**。费率和补充 — 在网站上: [createya.ai](https://createya.ai)。
---
## 🤖 MCP 服务器的作用
连接后,您的代理将获得 **4 种工具**:
| 工具 | 描述 |
|---|---|
| 🔍 **`list_models`** | 具有 `parameters_schema` 的所有模型目录。代理商自己了解可以调用的内容。 |
| 🎨 **`run_model`** | 生成:`{ model: <slug 或 family>, input: {...} }`。图像 / 视频 / 音频 / 文本。 |
| ⏳ **`get_run_status`** | 查询异步任务的状态(视频通常需要 30-180 秒)。 |
| 💰 **`get_balance`** | 工作区积分余额。 |
**端点:** `https://api.createya.ai/mcp`
**传输:** Streamable HTTP (MCP spec 2025-06-18)
**授权:** OAuth 2.1 (适用于 Claude.ai)或 Bearer 头(适用于其他所有情况)
---
## ⚙️ 连接 — 选择您的工具
### A. OAuth — 最简单的路径(Claude Desktop / Claude.ai / Claude Code)
1. **Claude.ai** → [设置 → 连接器](https://claude.ai/settings/connectors) → **添加自定义连接器**
**Claude Desktop** → 菜单 `+` → `连接器` → `添加自定义连接器`
2. 服务器 URL:`https://api.createya.ai/mcp`
3. Claude 将打开 Createya 的授权页面 — 插入您的 `crya_sk_...` 密钥 → **允许**
4. 完成。工具(`list_models`,`run_model`...)将出现在聊天中。
> 💡 每个团队成员 — 自己的密钥。积分从绑定的工作区扣除。
### B. Claude Code (CLI)
**一键安装 MCP 和技能:**
```bash
curl -fsSL https://api.createya.ai/install | bash -s -- crya_sk_YOUR_KEY
```
或仅安装 MCP,无技能:
```bash
claude mcp add createya "https://api.createya.ai/mcp" \
--transport http \
--header "Authorization: Bearer crya_sk_..." \
--scope user
```
### C. Cursor
`~/.cursor/mcp.json` (全局)或 `.cursor/mcp.json` (在项目中):
```json
{
"mcpServers": {
"createya": {
"url": "https://api.createya.ai/mcp",
"headers": {
"Authorization": "Bearer crya_sk_..."
}
}
}
}
```
### D. Cline (VS Code)
在 `settings.json` 中:
```json
{
"cline.mcpServers": {
"createya": {
"type": "streamableHttp",
"url": "https://api.createya.ai/mcp",
"headers": { "Authorization": "Bearer crya_sk_..." },
"disabled": false
}
}
}
```
> 类型 — `streamableHttp` (驼峰式,无连字符)。
### E. Windsurf
`~/.codeium/windsurf/mcp_config.json`:
```json
{
"mcpServers": {
"createya": {
"serverUrl": "https://api.createya.ai/mcp",
"headers": { "Authorization": "Bearer crya_sk_..." }
}
}
}
```
### F. OpenAI Codex
**直接通过 MCP** — 将 [`configs/codex.toml`](configs/codex.toml) 中的模板添加到 `~/.codex/config.toml` 中:
```toml
[mcp_servers.createya]
url = "https://api.createya.ai/mcp"
http_headers = { Authorization = "Bearer crya_sk_..." }
enabled = true
```
**Codex 插件** — 插件位于 [`plugins/createya-mcp/`](plugins/createya-mcp/)。它在 Codex Plugins UI 中添加了 Createya 卡片,徽标,MCP 服务器和所有 Createya 技能。详细说明: [`docs/codex-plugin.md`](docs/codex-plugin.md)。
`skills/` 在根目录下 — 事实来源。编辑技能或资产后,请更新插件包:
```bash
scripts/sync-codex-plugin.sh
```
CI 检查 `plugins/createya-mcp/skills/` 和 `plugins/createya-mcp/assets/` 是否与根目录不分离。
Codex Desktop:
1. 打开 Codex → 插件 → 添加市场。
2. 在 **来源** 字段中插入 `Createya-ai/Createya-mcp`。
3. **Git ref** 不更改。
4. **选择路径** 留空。
5. 点击 **添加市场**,找到 **Createya** 并安装插件。
通过终端:
```bash
codex plugin marketplace add Createya-ai/Createya-mcp
```
从存储库克隆进行本地检查:
```bash
codex plugin marketplace add /path/to/Createya-mcp
```
安装后,请通过 Createya 进行授权。
### G. OpenCode
参见 [`configs/opencode.json`](configs/opencode.json) — 现成模板。
### H. 任何其他 MCP 客户端
准备好的配置文件 — 在 [`configs/`](configs/) 目录中。复制需要的配置文件,将 `crya_sk_...` 替换为您的密钥 — 完成。
---
## 🎨 模型目录
完整的文档和示例 — 在单独的子域名 **[docs.createya.ai/models/](https://docs.createya.ai/models/)** 上(每周与 live API 同步)。
### 目前通过 MCP/REST 公开可用(5 个端点)
| 模型 | 类型 | Slug | 详情 |
|---|---|---|---|
| **Nano Banana 2** | 图像 | `nano-banana-2` | [docs.createya.ai/models/nano-banana-2](https://docs.createya.ai/models/nano-banana-2) |
| **Nano Banana 2 Edit** | 图像(i2i) | `nano-banana-2-edit` | [docs.createya.ai/models/nano-banana-2-edit](https://docs.createya.ai/models/nano-banana-2-edit) |
| **Nano Banana Pro** | 图像 | `nano-banana-pro` | [docs.createya.ai/models/nano-banana-pro](https://docs.createya.ai/models/nano-banana-pro) |
| **GPT Image 2** | 图像 | `gpt-image-2` | [docs.createya.ai/models/gpt-image-2](https://docs.createya.ai/models/gpt-image-2) |
| **GPT Image 2 Edit** | 图像(i2i) | `gpt-image-2-edit` | [docs.createya.ai/models/gpt-image-2-edit](https://docs.createya.ai/models/gpt-image-2-edit) |
### 即将推出(140+ 端点)
正在开发 — 开放以下系列的公共访问权限:
**FLUX 2 / Kontext** · **Sora 2** · **Veo 3.1** / Fast · **Kling Video O3 / V3 / 4K** · **Seedance 2.0** · **Happy Horse** · **Hailuo 2.3** · **Higgsfield Soul** · **Midjourney** · **Runway Gen-4** · **Recraft** · **Ideogram** · **Imagen** · **Wan** · **Grok Imagine** · **Seedream** 等。
📚 **通过 API 的实时目录**:`GET https://api.createya.ai/v1/models` (公开,无身份验证)
📖 **市场概览** 模型: [createya.ai/knowledge](https://createya.ai/knowledge)
📡 **API 文档** + 按模型分页: [docs.createya.ai](https://docs.createya.ai)
---
## 💡 使用示例
### 生成图像
```
你:通过 Createya 生成图像 — 月球上的猫,以 Studio Ghibli 风格,16:9 格式
代理:[调用 createya:run_model,model=nano-banana-2]
→ 返回图像的 CDN 链接
```
[`examples/01-generate-image.md`](examples/01-generate-image.md) — 更多详情。
### 生成视频
```
你:取这个图片(URL)并通过 Kling 动画,5 秒
代理:[调用 createya:run_model,model=kling-video-o3,image_url=...]
→ 返回运行 ID
→ 30-60 秒后:createya:get_run_status → 准备好的视频
```
[`examples/02-generate-video.md`](examples/02-generate-video.md)
### 无 MCP 的 REST
- [`examples/05-rest-curl.md`](examples/05-rest-curl.md) — curl (同步 + 异步 + 上传)
- [`examples/06-rest-python.md`](examples/06-rest-python.md) — Python 客户端
- [`examples/07-rest-nodejs.md`](examples/07-rest-nodejs.md) — TypeScript / Node.js / Express / Next.js
- [`examples/08-rest-go.md`](examples/08-rest-go.md) — Go (标准库,无依赖)
- [`examples/09-rest-php.md`](examples/09-rest-php.md) — PHP / Laravel / Symfony
- [`examples/03-async-polling.md`](examples/03-async-polling.md) — 异步任务(视频)指数回波
- [`examples/04-upload-image.md`](examples/04-upload-image.md) — 上传图片用于图像转换
- [`examples/10-error-handling.md`](examples/10-error-handling.md) — 所有错误的处理器,重试模式
---
## 📡 无 MCP — 普通 REST API
如果你不是代理,而是开发者 — 有 REST API。一个 Bearer 令牌,一个 POST 请求,就完成了。
### 步骤 1 — 获取令牌
1. 在 [createya.ai](https://createya.ai) 注册(获得 100 个免费积分)
2. 进入 [createya.ai/settings/api-keys](https://createya.ai/settings/api-keys)
3. **创建新密钥** → 给它命名(例如 `my-bot-prod`)→ **创建**
4. **复制密钥** — 它只显示 **一次**。格式:`crya_sk_<32hex>`
5. 保存在安全的地方(环境变量,秘密管理器,不在 git 中)
### 步骤 2 — 第一个请求
```bash
curl -X POST https://api.createya.ai/v1/run \
-H "Authorization: Bearer crya_sk_..." \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"input": {
"prompt": "月球上的猫,以 Studio Ghibli 风格",
"aspect_ratio": "16:9"
}
}'
```
**响应:**
```json
{
"run_id": "run_01HZX...",
"status": "completed",
"output": {
"urls": ["https://cdn-new.createya.ai/image/profile-id/abc123.png"]
}
}
```
### 步骤 3 — Python / Node.js / Go
**Python** (使用 `requests`):
```python
import os, requests
KEY = os.environ["CREATEYA_API_KEY"]
r = requests.post(
"https://api.createya.ai/v1/run",
headers={"Authorization": f"Bearer {KEY}"},
json={"model": "nano-banana-2", "input": {"prompt": "月球上的猫"}}
)
print(r.json()["output"]["urls"][0])
```
**Node.js** (原生 fetch,Node 18+):
```javascript
const KEY = process.env.CREATEYA_API_KEY;
const r = await fetch("https://api.createya.ai/v1/run", {
method: "POST",
headers: {
"Authorization": `Bearer ${KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "nano-banana-2",
input: { prompt: "月球上的猫" }
})
});
const json = await r.json();
console.log(json.output.urls[0]);
```
**Go**:
```go
body := strings.NewReader(`{"model":"nano-banana-2","input":{"prompt":"月球上的猫"}}`)
req, _ := http.NewRequest("POST", "https://api.createya.ai/v1/run", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("CREATEYA_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
```
→ 完整示例: [`examples/05-rest-curl.md`](examples/05-rest-curl.md), [`examples/06-rest-python.md`](examples/06-rest-python.md), [`examples/07-rest-nodejs.md`](examples/07-rest-nodejs.md)
### 异步任务(视频,长时间音乐)
```bash
# 步骤 1 — 启动
curl -X POST https://api.createya.ai/v1/run \
-H "Authorization: Bearer crya_sk_..." \
-H "Content-Type: application/json" \
-d '{"model":"kling-video-o3","input":{"image_url":"https://...","duration":5}}'
# → 202 Accepted, { "run_id": "run_01J2...", "status": "queued" }
# 步骤 2 — 每 10 秒轮询
curl https://api.createya.ai/v1/runs/run_01J2... \
-H "Authorization: Bearer crya_sk_..."
# → { "status": "completed", "output": { "url": "https://cdn-new.createya.ai/video/..." } }
```
### 所有 REST 端点
| 方法 | URL | 执行操作 |
|---|---|---|
| `GET` | `/v1/models` | 所有模型的目录,包含 `parameters_schema` |
| `POST` | `/v1/run` | 启动生成 |
| `GET` | `/v1/runs/{run_id}` | 异步任务的状态 |
| `GET` | `/v1/balance` | 工作区积分余额 |
| `POST` | `/v1/uploads` | 将图片/视频上传到 Createya CDN(用于图像转换) |
| `GET` | `/v1/openapi.json` | OpenAPI 3.1 规范(用于自动生成 SDK) |
### 机器可读的规范
- **OpenAPI 3.1**:`https://api.createya.ai/v1/openapi.json` — 用于自动生成 Python/TypeScript/Java/Ruby SDK
- **llms.txt**:`https://api.createya.ai/llms.txt` — AI 代理的 API 映射
- **完整文档**: [createya.ai/api](https://createya.ai/api)
---
## 🏢 企业
Createya 与公司签订合同,通过非现金结算。
- **非现金结算** — 我们开具发票,公司使用结算账户付款
- **合同 + 法案** — 记账凭证用于会计
- **增值税** — 含增值税或不含增值税的发票,视情况而定
- **批量包** — 批量折扣单独商议
- **API 负载** — 提高速率限制,服务的专用密钥
- **152-ФЗ** — 所有数据都存储在本地,完全符合法律要求 “关于个人数据”
- **白标** — 您的品牌 Telegram 机器人 / 网络站点是可能的
📩 详细信息和账户: [support@createya.ai](mailto:support@createya.ai)
---
## 🔐 安全
- **API 密钥** — 格式 `crya_sk_<32hex>`,存储为哈希(bcrypt)
- **工作区隔离** — 密钥绑定到一个工作区,不能从另一个工作区扣除积分
- **OAuth 2.1 + PKCE** — 用于 Web 客户端(Claude.ai)
- **速率限制** — 在密钥级别,保护免受泄密
- **152-ФЗ** — 所有数据都存储在本地
---
## 📚 文档
| 文档 | 在哪里 |
|---|---|
| 快速入门 REST | [createya.ai/api/getting-started](https://createya.ai/api/getting-started) |
| 完整的 REST 规范 | [createya.ai/api/rest](https://createya.ai/api/rest) |
| MCP 连接器 | [createya.ai/api/mcp](https://createya.ai/api/mcp) |
| OpenAPI 3.1 | [api.createya.ai/v1/openapi.json](https://api.createya.ai/v1/openapi.json) |
| 模型目录 | [createya.ai/knowledge](https://createya.ai/knowledge) |
| 示例代码 | [`examples/`](examples/) |
---
## 💬 联系
- 🌐 **网站:** [createya.ai](https://createya.ai)
- 📚 **知识库:** [createya.ai/knowledge](https://createya.ai/knowledge)
- 🤖 **Telegram 机器人** (直接生成,无需代码): [@createya_bot](https://t.me/createya_bot)
- 📧 **支持:** [support@createya.ai](mailto:support@createya.ai)
- 💼 **合作伙伴 / 大使:** [createya.ai/ambassador](https://createya.ai/ambassador)
---
## 🤝 贡献
欢迎 PR — 新的 MCP 客户端配置,新语言示例,修复错误。参见 [CONTRIBUTING.md](CONTRIBUTING.md) 获取指南。
发现漏洞或希望添加模型 — 打开 [issue](https://github.com/Createya-ai/createya-mcp/issues/new/choose)。
漏洞 — 不要公开 issue,请发送至 [security@createya.ai](mailto:security@createya.ai)。参见 [SECURITY.md](SECURITY.md)。
---
## 📄 许可证
[MIT](LICENSE) — 使用、修改、分享。只需注明作者。
---
<div align="center">
**Createya — 无边界的神经网络世界。适用于全球 AI 代理。**
⭐ 如果本仓库对您有帮助,请给我们一颗星!
</div>
MCP 配置
以下是此 MCP Server 的配置信息,可直接复制到 Cursor 或其他 MCP 客户端中使用。
mcp.json
连接信息
猜你喜欢
暂无推荐服务器