{{ t('cloudServer') }}
{{ ecsCount }}{{ t('servers') }}
{{ runningEcsCount }} {{ t('running') }}
{{ t('aiCalls') }}
{{ monthlyAiCalls }}{{ t('calls') }}
{{ t('running') }} {{ monthlyAiTokens }} Tokens
{{ t('accountBalance') }}
¥{{ userBalance.toFixed(2) }}
{{ t('lowBalance') }} {{ t('running') }} ¥{{ monthlyCost }}
{{ t('aiCost') }}
¥{{ aiCost }}
{{ t('payAsYouGo') }}

{{ t('quickActions') }}

{{ t('createServer') }}
{{ t('viewPrices') }}
{{ t('accountRecharge') }}
{{ t('viewUsage') }}
{{ model.name }}
{{ model.provider }}
{{ t('hot') }} {{ t('new') }}
{{ t('input') }}: ¥{{ model.inputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('output') }}: ¥{{ model.outputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('cache') }}: ¥{{ model.cacheInputPrice.toFixed(4) }} {{ t('unitTokens') }}
{{ model.name }}
{{ model.provider }}
{{ t('hot') }} {{ t('new') }}
{{ t('input') }}: ¥{{ model.inputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('output') }}: ¥{{ model.outputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('cache') }}: ¥{{ model.cacheInputPrice.toFixed(4) }} {{ t('unitTokens') }}
{{ model.name }}
{{ model.provider }}
{{ t('hot') }} {{ t('new') }}
{{ t('input') }}: ¥{{ model.inputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('output') }}: ¥{{ model.outputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ model.name }}
{{ model.provider }}
{{ t('hot') }} {{ t('new') }}
{{ t('input') }}: ¥{{ model.inputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('output') }}: ¥{{ model.outputPrice.toFixed(4) }} {{ model.unit || t('unitTokens') }}
{{ t('cache') }}: ¥{{ model.cacheInputPrice.toFixed(4) }} {{ t('unitTokens') }}
{{ t('totalCalls') }}
{{ usageStats.totalCalls }}
{{ t('totalTokens') }}
{{ usageStats.totalTokens }}
{{ t('totalCost') }}
¥{{ usageStats.totalCost.toFixed(2) }}
{{ label }}
{{ formatChartDate(item.time) }}
创建实例
{{ selectedEcs.id }} {{ selectedEcs.name }} {{ getStatusText(selectedEcs.status) }} {{ selectedEcs.spec }} {{ selectedEcs.region }} {{ selectedEcs.publicIp || '-' }} {{ selectedEcs.createdAt }}
包年包月 按量付费
{{ flavor.name }} ¥{{ ecsConfig.onDemand ? flavor.price.hourly : flavor.price.monthly }}/{{ ecsConfig.onDemand ? '时' : '月' }}
{{ demandStatus.ecs.satisfied ? '可售' : '不可售' }} {{ demandStatus.ecs.message }}
{{ demandStatus.ebs.satisfied ? '可售' : '不可售' }} {{ demandStatus.ebs.message }}
{{ ecsConfig.bootDiskSize }} GB
{{ ecsConfig.bandwidth }} Mbps
{{ demandStatus.eip.satisfied ? '可售' : '不可售' }} {{ demandStatus.eip.message }}
计费模式 {{ ecsConfig.onDemand ? '按量付费' : '包年包月' }}
地域 {{ ecsConfig.regionID === 'bb9fdb42056f11eda1610242ac110002' ? '北京' : ecsConfig.regionID === 'bb9fdb42056f11eda1610242ac110003' ? '上海' : '广州' }}
实例规格 {{ ecsConfig.flavorName }}
镜像 {{ ecsConfig.imageID }}
系统盘 {{ ecsConfig.bootDiskType }} {{ ecsConfig.bootDiskSize }} GB
公网IP {{ ecsConfig.extIP === '0' ? '不使用' : ecsConfig.extIP === '1' ? '自动分配 ' + ecsConfig.bandwidth + 'Mbps' : '使用已有' }}
购买时长 {{ ecsConfig.cycleCount }}个月
实例费用 ¥{{ calculateInstancePrice() }}
带宽费用 ¥{{ calculateBandwidthPrice() }}
总计 ¥{{ calculateTotalPrice() }}
立即购买

{{ t('apiKeyUsage') }}

{{ key.name }}
{{ key.key_prefix }}
{{ t('created') }} {{ formatDate(key.created_at) }}
{{ key.status === 'active' ? t('active') : t('inactive') }}
{{ t('disable') }} {{ t('enable') }} {{ t('delete') }}

{{ t('serviceOverview') }}

平台地址: https://nebulai.top
API基础路径: /api/proxy
版本: v1.0.0
认证方式: Bearer Token (API Key)

{{ t('importantNote') }}

{{ t('coreFeatures') }}

  • {{ t('aiChat') }}
  • {{ t('textVectorization') }}
  • {{ t('imageGeneration') }}
  • {{ t('videoGeneration') }}
  • {{ t('apiKeyMgmt') }}
  • {{ t('balanceQuery') }}

{{ t('quickStart') }}

{{ t('getApiKey') }}

{{ t('getApiKeyDesc') }}

{{ t('callApi') }}

{{ t('callApiDesc') }}

curl -X POST https://nebulai.top/api/proxy/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "cloud-llm",
    "messages": [{"role": "user", "content": "你好"}],
    "temperature": 0.7,
    "max_tokens": 512
  }'

{{ t('securityWarning') }}

Chat 对话API

POST /api/proxy/chat/completions 核心
调用AI模型进行对话,支持流式和非流式响应,自动扣除账户余额

请求参数

参数类型必填说明
modelstring模型ID,默认cloud-llm
messagesarray对话消息列表,包含role和content
streamboolean是否流式返回,默认false
max_tokensinteger最大生成Token数,默认512
temperaturefloat温度采样,范围(0, 2),默认0.7
top_pfloattop_p采样,范围(0, 1]
frequency_penaltyfloat频率惩罚,范围[-2, 2]
presence_penaltyfloat存在惩罚,范围[-2.0, 2.0]
stopstring/array停止标识

messages参数格式

[
  {"role": "system", "content": "你是一个有帮助的助手"},
  {"role": "user", "content": "你好"},
  {"role": "assistant", "content": "你好!有什么可以帮助你的吗?"}
]

响应示例(非流式)

{ "success": true, "id": "chatcmpl-abc123", "model": "cloud-llm", "choices": [{ "index": 0, "message": {"role": "assistant", "content": "你好!我是AI助手..."}, "finish_reason": "stop" }], "billing": { "input_tokens": 10, "output_tokens": 25, "total_tokens": 35, "cost": 0.00011, "balance": 99.99989, "currency": "CNY" } }

支持的模型

模型ID模型名称输入价格输出价格
cloud-llmDeepSeek-V3¥1.00/百万¥4.00/百万
glm-4GLM-4¥1.60/百万¥1.60/百万
glm-4-flashGLM-4-Flash¥0.16/百万¥0.16/百万

调用示例(curl)

curl -X POST https://nebulai.top/api/proxy/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cloud-llm",
    "messages": [{"role": "user", "content": "你好"}],
    "temperature": 0.7,
    "max_tokens": 512
  }'

调用示例(Python)

import requests

API_BASE = "https://nebulai.top/api/proxy"
API_KEY = "sk-your-api-key-here"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

data = {
    "model": "cloud-llm",
    "messages": [{"role": "user", "content": "你好"}],
    "temperature": 0.7,
    "max_tokens": 1024
}

response = requests.post(
    f"{API_BASE}/chat/completions",
    headers=headers,
    json=data,
    timeout=60
)

result = response.json()
print("AI回复:", result['choices'][0]['message']['content'])
print("费用:", result['billing']['cost'])

Embeddings 文本向量化API

POST /api/proxy/embeddings
将文本转换为向量表示,便于语义检索、相似度计算等场景

请求参数

参数类型必填说明
modelstring向量化模型ID,默认text-embedding-v3
inputstring/array要向量化的文本或文本列表
encoding_formatstring编码格式:float或base64

调用示例(curl)

curl -X POST https://nebulai.top/api/proxy/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "这是一段需要向量化的文本"
  }'

批量向量化示例

curl -X POST https://nebulai.top/api/proxy/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": ["第一段文本", "第二段文本", "第三段文本"]
  }'

Image 图片生成API

POST /api/proxy/images/generate
根据文本描述生成图像

请求参数

参数类型必填说明
promptstring图像描述文本
modelstring图像生成模型
ninteger生成图片数量,默认1
sizestring图片尺寸,如"1024x1024"
response_formatstring响应格式:url或b64_json

调用示例

curl -X POST https://nebulai.top/api/proxy/images/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "一只可爱的橘猫在草地上玩耍",
    "n": 1,
    "size": "512x512"
  }'

Video 视频生成API

POST /api/proxy/video/generate
根据文本描述生成视频内容

请求参数

参数类型必填说明
modelstring视频生成模型(Sdance2.0 或 Sdance2.0-fast)
contentarray内容输入,包含type和text字段
ratiostring视频比例,默认16:9
durationinteger视频时长(秒),默认5
watermarkboolean是否添加水印,默认false

调用示例

curl -X POST https://nebulai.top/api/proxy/video/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Sdance2.0-fast",
    "content": [
      {
        "type": "text",
        "text": "写实风格,晴朗的蓝天之下,一大片白色的雏菊花田"
      }
    ],
    "ratio": "16:9",
    "duration": 5
  }'

响应示例

{ "success": true, "task_id": "video-task-12345", "message": "任务已提交,请通过任务ID查询进度" }
GET /api/proxy/video/tasks/{task_id}
查询视频生成任务的状态和结果

调用示例

curl "https://nebulai.top/api/proxy/video/tasks/video-task-12345?apiKey=YOUR_API_KEY"

响应示例

{ "task_id": "video-task-12345", "status": "completed", "result": { "video_url": "https://example.com/video.mp4" }, "duration": 5, "ratio": "16:9" }

状态说明

状态说明
pending等待处理
running生成中
completed完成
failed失败

Rerank 重排序API

POST /v1/rerank
对候选文档进行语义排序,常用于搜索结果重排序、问答检索等场景

请求参数

参数类型必填说明
modelstring重排序模型ID,默认bge-reranker
querystring查询文本
documentsarray候选文档列表
top_ninteger返回前N个结果,默认全部返回
return_documentsboolean是否返回原始文档内容,默认true

调用示例(curl)

curl -X POST https://nebulai.top/v1/rerank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "人工智能最新进展",
    "documents": [
      "深度学习是机器学习的一个分支...",
      "大语言模型在自然语言处理中取得了重大突破...",
      "计算机视觉技术近年来发展迅速..."
    ],
    "top_n": 2
  }'

Models 模型列表API

GET /v1/models 常用
获取平台支持的所有模型列表,包含模型ID、名称、类型、价格等信息

请求参数

参数类型必填说明
typestring模型类型过滤:text/embedding/vision/rerank/all,默认all

调用示例(curl)

curl -X GET "https://nebulai.top/v1/models" \
  -H "Authorization: Bearer YOUR_API_KEY"

调用示例(Python)

import requests

API_BASE = "https://nebulai.top"
API_KEY = "sk-your-api-key-here"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# 获取所有模型
response = requests.get(f"{API_BASE}/v1/models", headers=headers)
models = response.json()

# 获取文本模型
response = requests.get(f"{API_BASE}/v1/models?type=text", headers=headers)
text_models = response.json()

print("可用模型列表:")
for model in models['data']:
    print(f"- {model['id']}: {model['name']} ({model['type']})")

响应示例

{ "success": true, "data": [ { "id": "deepseek-v4-pro", "name": "DeepSeek-V4-Pro", "type": "text", "provider": "深度求索", "input_price": 0.012, "output_price": 0.024, "description": "高性能大语言模型,支持复杂推理" }, { "id": "text-embedding-v3", "name": "Text-Embedding-V3", "type": "embedding", "provider": "阿里", "input_price": 0.002, "output_price": 0, "description": "文本向量化模型" }, { "id": "qwen-image-plus", "name": "Qwen-Image-Plus", "type": "vision", "provider": "阿里", "input_price": 0.15, "output_price": 0, "description": "图像生成模型" }, { "id": "bge-reranker", "name": "BGE-Reranker", "type": "rerank", "provider": "BAAI", "input_price": 0.5, "output_price": 0, "description": "语义重排序模型" } ], "total": 4, "types": ["text", "embedding", "vision", "rerank"] }

四种核心模型调用指南

💬

Chat Completions

对话生成

POST /api/proxy/chat/completions
流式响应 多轮对话 参数可调

curl 示例

curl -X POST https://nebulai.top/api/proxy/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "DeepSeek-V3",
    "messages": [
      {"role": "user", "content": "你好"}
    ],
    "stream": false
  }'
📊

Embeddings

文本向量化

POST /api/proxy/embeddings
批量处理 向量检索 语义匹配

curl 示例

curl -X POST https://nebulai.top/api/proxy/embeddings \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-v4",
    "input": "人工智能最新进展",
    "encoding_format": "float"
  }'
🎨

Images

图像生成

POST /api/proxy/images/generate
文生图 多图生成 尺寸可调

curl 示例

curl -X POST https://nebulai.top/api/proxy/images/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "一只可爱的橘猫在草地上玩耍,阳光明媚",
    "n": 1,
    "size": "512x512"
  }'
🔄

Rerank

语义重排序

POST /api/proxy/v1/rerank
搜索增强 结果排序 相关性评分

curl 示例

curl -X POST https://nebulai.top/api/proxy/v1/rerank \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-rerank",
    "query": "什么是人工智能",
    "documents": [
      "AI是计算机科学的分支",
      "机器学习是AI的核心技术",
      "深度学习是机器学习的一种"
    ],
    "top_n": 2
  }'

📖 使用流程

  1. 获取API Key: 登录平台 → API Key管理 → 创建密钥
  2. 查看模型列表: 调用 GET /v1/models 获取可用模型
  3. 选择合适模型: 根据需求选择文本/向量/图像/重排序模型
  4. 调用API: 携带API Key发起请求
  5. 查看消费: 在用户中心查看余额和消费记录

💡 调用小贴士

  • 流式响应: 对话API支持stream模式,适合实时聊天场景
  • 批量处理: Embeddings支持批量向量化,提高效率
  • 价格参考: 不同模型价格不同,调用前可查看模型列表中的价格信息
  • 错误处理: 注意处理API返回的错误码,如余额不足、参数错误等

🔄 如何更换模型

更换模型非常简单,只需要修改请求中的 model 参数即可:

示例:从 DeepSeek 切换到 Qwen

# 原请求(使用DeepSeek)
curl -X POST https://nebulai.top/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"model": "deepseek-v4-pro", "messages": [...]}'

# 更换后(使用Qwen)
curl -X POST https://nebulai.top/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"model": "qwen3-32b", "messages": [...]}'

更换模型的步骤

  1. 查询可用模型: 调用 GET /v1/models 获取所有可用模型
  2. 选择目标模型: 根据模型类型和价格选择合适的模型
  3. 修改请求参数: 将请求中的 model 字段改为目标模型ID
  4. 测试调用: 发起请求验证是否正常工作

各API更换模型的位置

API参数位置示例
Chat Completionsmodel 字段"model": "deepseek-v4-pro"
Embeddingsmodel 字段"model": "text-embedding-v3"
Imagesmodel 字段(可选)"model": "qwen-image-plus"
Rerankmodel 字段(可选)"model": "bge-reranker"

提示: 如果不指定 model 参数,API会使用默认模型。不同类型的API有不同的默认模型。

余额与计费API

GET /api/proxy/balance/{user_id}
查询用户账户余额

调用示例

curl "https://nebulai.top/api/proxy/balance/user123"
GET /api/proxy/usage/{user_id}?period={period}
查询用户使用记录(today/week/month)

调用示例

curl "https://nebulai.top/api/proxy/usage/user123?period=week"

错误码说明

HTTP状态码错误码说明解决方法
401MISSING_API_KEY缺少API Key在请求头中添加Authorization: Bearer YOUR_API_KEY
401INVALID_API_KEY无效的API Key检查API Key是否正确
402INSUFFICIENT_BALANCE余额不足请充值后再试
403PERMISSION_DENIEDAPI Key无权限访问此接口检查API Key权限设置
400INVALID_REQUEST请求参数错误检查请求参数格式
404MODEL_NOT_FOUND模型不存在使用GET /api/proxy/models查询可用模型
429RATE_LIMIT_EXCEEDED请求超限稍后重试或联系客服
500PROXY_ERROR代理服务内部错误稍后重试

SDK示例

JavaScript/Node.js

const axios = require('axios');

const API_BASE = 'https://nebulai.top/api/proxy';
const API_KEY = 'sk-your-api-key-here';

async function chat() {
  const response = await axios.post(
    `${API_BASE}/chat/completions`,
    {
      model: 'cloud-llm',
      messages: [{ role: 'user', content: '你好' }],
      temperature: 0.7,
      max_tokens: 512
    },
    {
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    }
  );
  
  console.log('AI回复:', response.data.choices[0].message.content);
  console.log('费用:', response.data.billing.cost);
}

async function getEmbedding(text) {
  const response = await axios.post(
    `${API_BASE}/embeddings`,
    { input: text },
    {
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    }
  );
  return response.data.data[0].embedding;
}

chat();

Python

import requests

API_BASE = "https://nebulai.top/api/proxy"
API_KEY = "sk-your-api-key-here"

def chat():
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    
    data = {
        "model": "cloud-llm",
        "messages": [{"role": "user", "content": "你好"}],
        "temperature": 0.7,
        "max_tokens": 512
    }
    
    response = requests.post(f"{API_BASE}/chat/completions", headers=headers, json=data)
    result = response.json()
    
    print("AI回复:", result['choices'][0]['message']['content'])
    print("费用:", result['billing']['cost'])

def get_embedding(text):
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }
    
    data = {"input": text}
    response = requests.post(f"{API_BASE}/embeddings", headers=headers, json=data)
    return response.json()['data'][0]['embedding']

if __name__ == "__main__":
    chat()

curl

# 对话接口
curl -X POST https://nebulai.top/api/proxy/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cloud-llm",
    "messages": [{"role": "user", "content": "你好"}],
    "temperature": 0.7
  }'

# 向量化接口
curl -X POST https://nebulai.top/api/proxy/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "这是一段文本"}'

# 查询余额
curl "https://nebulai.top/api/proxy/balance/user123"

注意事项

  • API Key安全: 不要在客户端代码中暴露API Key,建议通过后端服务转发请求
  • 超时设置: 流式请求建议设置较长的超时时间(120秒以上)
  • 错误重试: 建议实现指数退避重试机制
  • Token限制: 注意控制输入输出token数,避免超出模型限制
  • 权限控制: 为不同应用场景创建不同的API Key,分配最小必要权限
  • 请求频率: 默认限制每分钟100次请求,如需更高限额请联系客服
  • 计费方式: 按Token/调用次数计费,余额不足时接口返回402错误
  • 联系我们: 如有问题请发送邮件至 support@nebulai.top
{{ t('currentBalance') }}
¥{{ userBalance.toFixed(2) }}
{{ t('recharge') }}