BazaarLinkBazaarLink
เข้าสู่ระบบ
เอกสารAPI ข้อมูลอ้างอิงSDK ข้อมูลอ้างอิงการใช้งาน AgentAI ทักษะ
Management Key

สร้างคีย์ BYOK

สร้างคีย์ upstream BYOK ให้องค์กรและซิงก์แคตตาล็อกโมเดลทันที apiKey ของ upstream ปรากฏเป็นข้อความล้วนเฉพาะในคำขอนี้ — ถูกเข้ารหัสเมื่อจัดเก็บ และหลังจากนั้นคืนเฉพาะรูปแบบปิดบัง (keyMask) สำเร็จตอบ 201 พร้อมอ็อบเจ็กต์คีย์และผลการซิงก์ (sync)

POST/api/v1/management/byok-keys

การอนุญาต

Authorizationจำเป็น
string · header

API key เป็น bearer token ใน header Authorization

Body

nameจำเป็น
string

ชื่อที่แสดงของคีย์

1-200 chars
baseUrlจำเป็น
string

Base URL ของ API ผู้ให้บริการ upstream ที่อยู่แบบส่วนตัว/ภายในถูกปฏิเสธ (400)

1-2000 chars, public HTTPS endpoint
apiKeyจำเป็น
string

API key ของผู้ให้บริการ upstream แบบข้อความล้วน ปรากฏเฉพาะคำขอนี้ เข้ารหัสเมื่อเก็บ หลังจากนั้นคืนเฉพาะ keyMask

1-2000 chars
protocol
string

โปรโตคอล API ของ upstream ค่าเริ่มต้น openai

openaianthropic
Example: "openai"
fallbackMode
string

พฤติกรรมเมื่อ upstream ล้มเหลว: seamless (ค่าเริ่มต้น) ถอยกลับไปใช้เส้นทางแพลตฟอร์ม; strict ไม่ถอยกลับ คืน error

seamlessstrict
Example: "seamless"
disabledCanonicalIds
string[]

รายการโมเดล (canonical id) ที่จะปิดตอนสร้าง หลังซิงก์โมเดลเหล่านี้จะไม่ผ่านคีย์นี้

≤2000 items
scopedApiKeyIds
string[]

จำกัด BYOK นี้ให้ใช้กับ API key แพลตฟอร์มที่ระบุ (ตาม id) ว่าง/ละไว้ = ใช้กับทุกคีย์ขององค์กร ใส่ id ที่ไม่ใช่ของคุณจะถูกปฏิเสธ (400)

≤200 items; must be your own keys
POST /api/v1/management/byok-keys
curl https://bazaarlink.ai/api/v1/management/byok-keys \
  -H "Authorization: Bearer $BAZAARLINK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "team-upstream",
    "baseUrl": "https://api.example-upstream.com/v1",
    "apiKey": "'$UPSTREAM_API_KEY'",
    "protocol": "openai",
    "fallbackMode": "seamless"
  }'
ตัวอย่างการตอบกลับ

สร้างแล้ว key คืออ็อบเจ็กต์คีย์ (เฉพาะ keyMask); sync รายงานผลซิงก์แคตตาล็อก: matched (จำนวนโมเดลที่จับคู่กับแคตตาล็อกแพลตฟอร์ม), unmatched (id โมเดล upstream ที่ไม่มีในแคตตาล็อก), stale (ต้องซิงก์ใหม่ภายหลังหรือไม่)

{
  "key": {
    "id": "byok_abc123",
    "ownerType": "org",
    "userId": null,
    "organizationId": "org_abc123",
    "name": "team-upstream",
    "baseUrl": "https://api.example-upstream.com/v1",
    "keyMask": "sk-abc…wxyz",
    "protocol": "openai",
    "enabled": true,
    "fallbackMode": "seamless",
    "modelsStale": false,
    "lastVerifiedAt": "2026-07-29T00:00:00.000Z",
    "lastErrorAt": null,
    "lastErrorCode": null,
    "errorCount1h": 0,
    "createdAt": "2026-07-29T00:00:00.000Z",
    "updatedAt": "2026-07-29T00:00:00.000Z",
    "models": [
      {
        "canonicalId": "openai/gpt-4o",
        "upstreamModelId": "gpt-4o",
        "enabled": true
      }
    ],
    "scopedApiKeyIds": []
  },
  "sync": {
    "matched": 12,
    "unmatched": [
      "internal-model-x"
    ],
    "stale": false
  }
}
Support
Support
Hi! How can we help you?
Send a message and we'll get back to you soon.
สร้างคีย์ BYOK — BazaarLink API