AnLinkAI

快速开始

从内测资格到第一次引导式测试请求。

本页面面向当前内测开发者,默认你会使用 OpenAI-compatible chat completions 路径和控制台签发的 API Key 进行引导式测试。

curl https://api.anlinkai.com/api/v1/chat/completions \
  -H "Authorization: Bearer ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-flash",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Write a release note headline."}
    ]
  }'

步骤

推荐集成顺序

第一次接入保持简单。先确认账号权限、API Key 创建和一次成功请求,再扩展流量形态。

1. 注册并登录

  • 打开控制台并创建账号
  • 确认登录后可以进入概览页
  • 最高 $2 试用额度:初始 $1,通过内测资料审核后追加 $1。

2. 创建 API Key

  • 为当前测试环境创建一个 key
  • 创建后立即复制明文 key
  • 将 key 存放在服务端环境变量中

3. 选择 active 模型

  • 使用文档站或控制台中的模型目录
  • 先从状态为 active 的模型开始
  • 使用精确暴露的模型 ID,例如 qwen-flash

4. 发送 chat completions 请求

  • 目标地址为 https://api.anlinkai.com/api/v1/chat/completions
  • 通过 Authorization: Bearer ... 传入 key
  • 先使用小 prompt,便于定位失败原因

5. 验证结果

  • 确认响应体是合法 JSON
  • 打开控制台 Usage Logs
  • 检查请求状态、token 数量和记录费用

6. 处理失败

  • 尽可能保留失败调用的 request ID
  • 确认模型是否仍为 active
  • 确认账号是否仍有剩余额度

示例

参考请求结构

这些示例对应当前 Beta 能力边界,不是未来多端点版本。

cURL

curl https://api.anlinkai.com/api/v1/chat/completions \
  -H "Authorization: Bearer ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-flash",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Write a release note headline."}
    ]
  }'

JavaScript

const response = await fetch("https://api.anlinkai.com/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.ANLINK_API_KEY,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "qwen-flash",
    messages: [
      { role: "system", content: "You are a concise assistant." },
      { role: "user", content: "Write a release note headline." }
    ]
  })
});

const data = await response.json();
console.log(data);

JavaScript Streaming

const response = await fetch("https://api.anlinkai.com/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.ANLINK_API_KEY,
    "Content-Type": "application/json",
    "Accept": "text/event-stream"
  },
  body: JSON.stringify({
    model: "qwen-flash",
    messages: [
      { role: "system", content: "You are a concise assistant." },
      { role: "user", content: "Write a release note headline." }
    ],
    stream: true,
    stream_options: { include_usage: true }
  })
});

const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = "";

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buffer += decoder.decode(value, { stream: true });
  const events = buffer.split("\n\n");
  buffer = events.pop() || "";
  for (const event of events) {
    const data = event.split("\n").find(line => line.startsWith("data:"))?.replace(/^data:\s*/, "");
    if (!data || data === "[DONE]") continue;
    const chunk = JSON.parse(data);
    process.stdout.write(chunk.choices?.[0]?.delta?.content || "");
  }
}

Python

import os
import requests

resp = requests.post(
    "https://api.anlinkai.com/api/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.environ['ANLINK_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "qwen-flash",
        "messages": [
            {"role": "system", "content": "You are a concise assistant."},
            {"role": "user", "content": "Write a release note headline."},
        ],
    },
    timeout=60,
)

print(resp.status_code)
print(resp.json())

检查清单

在测试流量之外继续扩展前

  1. 不要把 API Key 暴露在浏览器端代码中。
  2. 每个环境使用独立 key,方便后续吊销。
  3. 记录失败请求,并与控制台 Usage Logs 对照。
  4. 路由验证完成前,保持 prompt 和并发较小。
  5. Beta 内测奖励:使用 USDT 充值并确认后,可获得 20% 额外可用额度。
  6. 自助充值验证期间,可通过 hello@anlinkai.com 使用人工充值支持,或查看 Billing and Recharge。

Console URL

https://console.anlinkai.com

API 基础地址

https://api.anlinkai.com/api/v1

主要接口

POST /chat/completions

常见问题

/zh-CN/faq

模型目录

/zh-CN/model-catalog

账单

/zh-CN/billing-and-recharge

支持

hello@anlinkai.com