開發指南

這裡集中放接入 GPT 和 Claude 時會用到的短說明。註冊和充值在網站上完成:/register 與 /purchase。目錄只有 GPT 和 Claude。

呼叫使用一般 HTTPS。OpenAI 協議的地址是 https://sujinai.com/v1,Anthropic 協議和 Claude Code 的地址是 https://sujinai.com(結尾不要加 /v1)。

快速開始

  1. 註冊,建立 API Key,並完成充值。
  2. GPT、Cursor、Cline、Cherry Studio 使用 https://sujinai.com/v1。Anthropic SDK 和 Claude Code 使用 https://sujinai.com。
  3. 模型名稱從價格說明裡選。首頁示例是 gpt-6.2-sol 和 claude-sonnet-5-5。
  4. 送一個短請求。地址多了或少了 /v1 是最常見的錯誤。
# OpenAI-compatible clients, including Cursor. GPT examples use this URL.
# https://sujinai.com/v1

# Anthropic SDK and Claude Code.
# https://sujinai.com

Python、Node、cURL

下面三則都走 OpenAI 相容地址,模型用 gpt-6.2-sol。

from openai import OpenAI

client = OpenAI(
    api_key="你的APIKey",
    base_url="https://sujinai.com/v1",
)

resp = client.chat.completions.create(
    model="gpt-6.2-sol",
    messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "你的APIKey",
  baseURL: "https://sujinai.com/v1",
});

const resp = await client.chat.completions.create({
  model: "gpt-6.2-sol",
  messages: [{ role: "user", content: "你好" }],
});
console.log(resp.choices[0].message.content);
curl https://sujinai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer 你的APIKey" \
  -d '{
    "model": "gpt-6.2-sol",
    "messages": [
      {"role": "user", "content": "你好"}
    ]
  }'

Claude 的 Python 示例把 base_url 設為不帶 /v1 的地址:

import anthropic

client = anthropic.Anthropic(
    api_key="你的APIKey",
    base_url="https://sujinai.com",
)

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "你好"}],
)
print(message.content[0].text)

分篇

常見問題

從哪裡開始?

先在 /register 註冊並建立 API Key,再到 /purchase 充值。然後依用戶端選擇帶不帶 /v1 的地址。

GPT 和 Claude 的地址一樣嗎?

不一樣。OpenAI 相容用戶端用 https://sujinai.com/v1。Anthropic SDK 和 Claude Code 用 https://sujinai.com。

價格寫在哪一頁?

價格說明,和首頁卡片是同一份美元標價。依實際 token 計費,沒有月費。

註冊並建立 Key

用電子信箱註冊,在控制台建立 API Key,然後到充值頁完成充值。也可以聯絡 [email protected]。

註冊開始 前往充值