Skip to content

快速开始

5 分钟内完成你的第一次 AI 中台 API 调用。

1. 获取 API Key

登录 智航云 AI 中台,在「设置」→「开发者」中创建 API Key。

或使用 API 创建:

bash
curl -X POST https://api.invoratec.cn/v1/auth/api-keys \
  -H "X-API-Key: YOUR_INITIAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My First Key"}'

响应:

json
{
  "key": "claw_a1b2c3d4...",
  "secret": "clsk_x9y8z7...",
  "message": "请妥善保存 secret,它只会显示一次。"
}

2. 第一次 AI 对话

bash
curl -X POST https://api.invoratec.cn/v1/ai/chat \
  -H "X-API-Key: claw_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{"message": "你好,介绍一下智航云 AI 中台"}'
json
{
  "response": "智航云 AI 中台是一个企业级 AI 平台...",
  "model": "claude-sonnet-4-20250514",
  "usage": { "inputTokens": 50, "outputTokens": 200 }
}

3. 注册你的第一个工具

bash
curl -X POST https://api.invoratec.cn/v1/tools \
  -H "X-API-Key: claw_a1b2c3d4..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "get_weather",
    "description": "查询城市天气",
    "input_schema": {
      "type": "object",
      "properties": {
        "city": { "type": "string", "description": "城市名称" }
      },
      "required": ["city"]
    },
    "execution": {
      "type": "http",
      "method": "GET",
      "url": "https://api.example.com/weather?city={city}"
    }
  }'

4. 安装 SDK

bash
pip install invoratec-ai
bash
npm install @invoratec/claw-sdk

5. 使用 SDK

python
from invoratec import ClawPlatform

claw = ClawPlatform(api_key="claw_a1b2c3d4...")

# AI 对话
response = claw.ai.chat("查询北京天气")
print(response.text)
javascript
const { ClawPlatform } = require('@invoratec/claw-sdk')
const claw = new ClawPlatform({ apiKey: 'claw_a1b2c3d4...' })

const res = await claw.ai.chat('查询北京天气')
console.log(res.text)

下一步

智航云 AI 中台 — 开发者平台