跳到主要内容

快速开始

本指南将帮助您快速开始使用云耀星 API 服务。

注册账号

  1. 访问云耀星 API 官网
  2. 点击"注册"按钮
  3. 填写必要信息并完成注册

获取 API Key

  1. 登录您的账户
  2. 进入"API 密钥"页面
  3. 点击"创建新密钥"
  4. 保存生成的 API Key(请妥善保管,不要泄露给他人)

API 使用说明

  • API Key 可设定使用时间和额度限制

调用示例

Python

import openai

openai.api_key = "your-api-key"
openai.api_base = "https://api.yunyx.top/v1"

response = openai.ChatCompletion.create(
model="gemini-1.5-pro-latest",
messages=[
{"role": "user", "content": "你好"}
]
)
print(response.choices[0].message.content)

Node.js

const { Configuration, OpenAIApi } = require("openai");

const configuration = new Configuration({
apiKey: "your-api-key",
basePath: "https://api.yunyx.top/v1",
});

const openai = new OpenAIApi(configuration);

async function chat() {
const response = await openai.createChatCompletion({
model: "gemini-1.5-pro-latest",
messages: [
{ role: "user", content: "你好" }
],
});
console.log(response.data.choices[0].message.content);
}

chat();

注意事项

  1. API Key 请勿泄露给他人
  2. 请合理使用 API,避免频繁、无意义的调用
  3. 如遇到问题,请及时联系客服