TH ▾
Base URL https://api.uncensoredaiapis.com/v1โมเดล uncensored
รับคีย์ API
Uncensored AIตัวอย่างโค้ด

ตัวอย่างโค้ด API ของ Uncensored AI ใน Python, Node.js และ cURL

หน้านี้รวบรวมโค้ดสำหรับคัดลอกและวางสำหรับ API AI แบบไม่เซ็นเซอร์ ซึ่งรองรับรูปแบบ chat completions ของ OpenAI คุณจะพบโค้ดเริ่มต้นใน Python, Node.js และ cURL การสตรีมผ่าน SDK และ raw fetch การเรียกใช้ฟังก์ชัน ลอจิกการลองใหม่สำหรับ 429 และ 503 สถานะหลายรอบ และการควบคุมต้นทุนด้วย max_tokens

ตัวอย่างโค้ด API ของ Uncensored AI ใน Python, Node.js และ cURL

อัปเดต

ประเด็นสำคัญ

  • ใช้ SDK openai แบบทางการโดยตั้งค่า base_url เป็น https://api.uncensoredaiapis.com/v1 และ model "uncensored" ไม่จำเป็นต้องใช้ไคลเอนต์แบบกำหนดเอง
  • สตรีมมิงส่งคืนข้อมูลแบบ SSE chunks และ usage chunk สุดท้ายจะมาถึงอัตโนมัติพร้อมรายการ choices ที่ว่างเปล่า
  • ลองใหม่เฉพาะ 429 และ 503 (upstream_busy); 400, 401, 402 และ 403 ต้องการการแก้ไข ไม่ใช่การลองใหม่
  • API นี้ไม่มีสถานะ: ให้ส่งประวัติทุกครั้งและจำกัดผลลัพธ์ด้วย max_tokens (ไม่บังคับ; หากไม่ได้ระบุ การตอบกลับอาจยาวจนเต็ม context window)

การเรียกครั้งแรก: Python, Node.js และ cURL

ตัวอย่างใช้ https://api.uncensoredaiapis.com/v1 โมเดล uncensored และ POST /v1/chat/completions หรือ GET /v1/models ส่งคีย์ปัจจุบันของคุณใน header Authorization: Bearer <key> หากจำเป็น สร้างบัญชี ขอเครดิตทดลองใช้หากมีสิทธิ์ และตรวจสอบว่ายอดเงินที่แสดงพร้อมใช้งานก่อนส่งคำขอ

ตัวอย่างเหล่านี้ดึงคีย์จากตัวแปรสภาพแวดล้อมชื่อ API_KEY ให้ส่งออกตัวแปรนี้ใน shell ของคุณเพียงครั้งเดียว แล้วโค้ดตัวอย่างทั้งหมดจะไม่ต้องแก้ไข อย่าวางคีย์ลงในซอร์สโค้ดหรือส่งไปกับ JavaScript บนเบราว์เซอร์ ให้เรียก API จากแบ็กเอนด์ของคุณ

export API_KEY="paste-your-key-here"

Python โดยใช้แพ็กเกจทางการ openai (เวอร์ชัน 1 หรือใหม่กว่า) ความแตกต่างเดียวจากการตั้งค่า OpenAI มาตรฐานคือ base_url และชื่อโมเดล

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a two-line villain monologue."}],
    max_tokens=200,
)
print(resp.choices[0].message.content)
print(resp.usage)

Node.js โดยใช้แพ็กเกจ npm openai (เวอร์ชัน 4 หรือใหม่กว่า) ในฐานะ ES module

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.uncensoredaiapis.com/v1",
  apiKey: process.env.API_KEY,
});

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Write a two-line villain monologue." }],
  max_tokens: 200,
});
console.log(resp.choices[0].message.content);
console.log(resp.usage);

และ cURL แบบธรรมดา ซึ่งเป็นวิธีที่เร็วที่สุดในการตรวจสอบว่าคีย์ใช้งานได้:

curl https://api.uncensoredaiapis.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a two-line villain monologue."}],
    "max_tokens": 200
  }'

การตอบกลับมีโครงสร้างแบบ OpenAI ทั่วไป: choices[0].message.content สำหรับข้อความ และวัตถุ usage ที่มีจำนวนโทเคนพรอมต์และการสร้างผลลัพธ์ ซึ่งคุณสามารถคูณด้วยราคาต่อโทเคนเพื่อติดตามการใช้จ่าย ดู เอกสารประกอบ สำหรับรายการพารามิเตอร์เต็มรูปแบบ

สตรีมมิง (SSE) ด้วย SDK

ตั้งค่า stream: true และ API จะส่ง server-sent events แทน JSON body เดียว SDK อย่างเป็นทางการทั้งสองตัวจะแปลงข้อมูลนี้ให้เป็น iterator ดังนั้นโค้ดของคุณจะวนลูปผ่าน chunks และพิมพ์แต่ละ delta chunk สุดท้ายที่บรรจุ token usage จะถูกเพิ่มโดยอัตโนมัติ คุณไม่จำเป็นต้องร้องขอ chunk นี้ chunk นี้มีรายการ choices ที่ว่างเปล่า ดังนั้นจึงต้องตรวจสอบ index ก่อนอ่านค่า

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
)

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Describe a rainy harbor town in 120 words."}],
    max_tokens=300,
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if chunk.usage:
        print("\n\nusage:", chunk.usage)

เวอร์ชัน Node.js ใช้ for await:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.uncensoredaiapis.com/v1",
  apiKey: process.env.API_KEY,
});

const stream = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Describe a rainy harbor town in 120 words." }],
  max_tokens: 300,
  stream: true,
});

for await (const chunk of stream) {
  const text = chunk.choices?.[0]?.delta?.content;
  if (text) process.stdout.write(text);
  if (chunk.usage) console.log("\n\nusage:", chunk.usage);
}

การสตรีมไม่เปลี่ยนราคา คุณจ่ายสำหรับโทเคนอินพุตและเอาต์พุตเท่าเดิม เพียงแต่คุณจะเห็นคำแรกเร็วขึ้น ซึ่งสำคัญสำหรับอินเทอร์เฟซแชทและ roleplay ที่การรอการตอบกลับขนาด 500 โทเคนเต็มรูปแบบรู้สึกช้า

สตรีมมิงด้วย raw fetch

หากคุณไม่ต้องการพึ่งพา SDK เช่น ใน edge function หรือสคริปต์ขนาดเล็ก คุณสามารถอ่าน stream เองได้ รูปแบบสายส่งเป็น plain SSE: แต่ละ event คือบรรทัดที่ขึ้นต้นด้วย data: ตามด้วย JSON chunk และ events ถูกคั่นด้วยบรรทัดว่าง Network chunk ไม่ตรงกับขอบเขตของ event ดังนั้นคุณต้อง buffer และ split ตาม newline ตัวอย่างด้านล่างรันบน Node 18 ขึ้นไป (บันทึกเป็น stream.mjs) และทำงานได้ใน runtime ใดๆ ที่มี fetch และ ReadableStream มาตรฐาน

const res = await fetch("https://api.uncensoredaiapis.com/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "uncensored",
    messages: [{ role: "user", content: "Tell a 100-word ghost story." }],
    max_tokens: 250,
    stream: true,
  }),
});

if (!res.ok) {
  throw new Error(`HTTP ${res.status}: ${await res.text()}`);
}

const decoder = new TextDecoder();
let buffer = "";

for await (const bytes of res.body) {
  buffer += decoder.decode(bytes, { stream: true });
  const lines = buffer.split("\n");
  buffer = lines.pop(); // keep the incomplete tail for the next round

  for (const line of lines) {
    if (!line.startsWith("data:")) continue;
    const data = line.slice(5).trim();
    if (data === "[DONE]") continue;
    const chunk = JSON.parse(data);
    const text = chunk.choices?.[0]?.delta?.content;
    if (text) process.stdout.write(text);
    if (chunk.usage) console.log("\n\nusage:", chunk.usage);
  }
}

ตรวจสอบ res.ok ก่อนเริ่มอ่าน ข้อผิดพลาดเช่น 401, 402 หรือ 403 จะมาในรูปแบบ body JSON ปกติที่มี error object ไม่ใช่ event stream ดังนั้นการ parse เป็น SSE จะไม่เกิดผลลัพธ์ใดๆ ใน browser คุณสามารถใช้ logic เดียวกันกับ res.body.getReader() แต่จำไว้ว่า browser ต้องเรียก backend ของคุณเอง ไม่ใช่เรียก API นี้โดยตรงด้วย secret key

การเรียกใช้ฟังก์ชันด้วยเครื่องมือและ tool_choice

การเรียกใช้ฟังก์ชันใช้รูปแบบ OpenAI คุณอธิบายฟังก์ชันใน tools โมเดลจะตอบกลับด้วย tool_calls แทนข้อความเมื่อต้องการเรียกใช้ฟังก์ชันหนึ่งครั้ง คุณเรียกใช้ฟังก์ชันเอง แล้วส่งผลลัพธ์กลับเป็นข้อความที่มี role: "tool" และ tool_call_id ที่ตรงกัน การร้องขอครั้งที่สองจะส่งคำตอบภาษาธรรมชาติสุดท้าย tool_choice ควบคุมพฤติกรรม: "auto" ให้โมเดลตัดสินใจ, "none" ห้ามใช้เครื่องมือ และออบเจ็กต์เช่น {"type": "function", "function": {"name": "get_order_status"}} บังคับใช้ฟังก์ชันนั้น

import json
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
)

def get_order_status(order_id: str) -> dict:
    # Replace with a real lookup.
    return {"order_id": order_id, "status": "shipped", "eta_days": 2}

tools = [{
    "type": "function",
    "function": {
        "name": "get_order_status",
        "description": "Look up the shipping status of an order by its id.",
        "parameters": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
        },
    },
}]

messages = [{"role": "user", "content": "Where is order A-1042?"}]

first = client.chat.completions.create(
    model="uncensored",
    messages=messages,
    tools=tools,
    tool_choice="auto",
    max_tokens=500,
)
msg = first.choices[0].message

if msg.tool_calls:
    messages.append(msg)  # keep the assistant turn that contains tool_calls
    for call in msg.tool_calls:
        args = json.loads(call.function.arguments)
        result = get_order_status(**args)
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": json.dumps(result),
        })
    final = client.chat.completions.create(
        model="uncensored",
        messages=messages,
        tools=tools,
        max_tokens=500,
    )
    print(final.choices[0].message.content)
else:
    print(msg.content)

ลูปเดียวกันใน Node.js:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.uncensoredaiapis.com/v1",
  apiKey: process.env.API_KEY,
});

const getOrderStatus = ({ order_id }) => ({ order_id, status: "shipped", eta_days: 2 });

const tools = [{
  type: "function",
  function: {
    name: "get_order_status",
    description: "Look up the shipping status of an order by its id.",
    parameters: {
      type: "object",
      properties: { order_id: { type: "string" } },
      required: ["order_id"],
    },
  },
}];

const messages = [{ role: "user", content: "Where is order A-1042?" }];

const first = await client.chat.completions.create({
  model: "uncensored", messages, tools, tool_choice: "auto", max_tokens: 500,
});
const msg = first.choices[0].message;

if (msg.tool_calls?.length) {
  messages.push(msg);
  for (const call of msg.tool_calls) {
    const result = getOrderStatus(JSON.parse(call.function.arguments));
    messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify(result) });
  }
  const final = await client.chat.completions.create({
    model: "uncensored", messages, tools, max_tokens: 500,
  });
  console.log(final.choices[0].message.content);
} else {
  console.log(msg.content);
}

หมายเหตุปฏิบัติสองประการ ประการแรก arguments คือสตริง JSON ที่ผลิตโดยโมเดลภาษา ดังนั้นให้ห่อ json.loads ไว้ในการจัดการข้อผิดพลาดในการผลิตและตรวจสอบความถูกต้องของฟิลด์ก่อนแตะฐานข้อมูล ประการที่สอง คำจำกัดความของเครื่องมือนับเป็นโทเคนอินพุตในแต่ละคำขอ ดังนั้นให้รักษาคำอธิบายให้สั้นและส่งเฉพาะเครื่องมือที่เกี่ยวข้องกับขั้นตอนปัจจุบันเท่านั้น

การลองใหม่แบบ backoff เมื่อเจอ 429 และ 503

ข้อผิดพลาดสองข้อที่ควรลองใหม่ 429 หมายถึงคุณเกินขีดจำกัด 300 คำขอต่อนาทีสำหรับคีย์ของคุณ 503 พร้อมรหัส upstream_busy หมายถึงบริการกำลังอิ่มตัวชั่วคราว; การรอไม่กี่วินาทีเป็นคำตอบที่ตั้งใจไว้ อย่าลองใหม่กับ 400 (แก้ไขคำขอ), 401 (แก้ไขคีย์), 402 no_credit (เติมเงินในยอดคงเหลือ), หรือ 403 content_blocked (คำขอจะถูกบล็อกอีกครั้ง) ข้อผิดพลาดมีโครงสร้าง JSON เดียวกัน {"error":{"code":...,"message":...}} ดังนั้นคุณสามารถบันทึกรหัสได้โดยตรง

SDK ของ OpenAI มีการลองใหม่ข้อผิดพลาดการเชื่อมต่อ, 429 และ 5xx โดยอัตโนมัติสองสามครั้งตามค่าเริ่มต้น และคุณสามารถเพิ่มจำนวนนั้นด้วย max_retries หากคุณต้องการควบคุมการหน่วงเวลา ให้ปิดการลองใหม่ในตัวและห่อหุ้มการเรียกใช้เอง โดยใช้ exponential backoff พร้อม jitter เพื่อให้ worker ขนานไม่ลองใหม่พร้อมกัน

import os
import random
import time
from openai import OpenAI, APIStatusError, APIConnectionError

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
    max_retries=0,  # we handle retries ourselves
)

RETRYABLE = {429, 503}

def chat_with_retry(messages, max_attempts=5, **kwargs):
    for attempt in range(max_attempts):
        try:
            return client.chat.completions.create(
                model="uncensored", messages=messages, **kwargs
            )
        except APIStatusError as e:
            if e.status_code not in RETRYABLE or attempt == max_attempts - 1:
                raise
        except APIConnectionError:
            if attempt == max_attempts - 1:
                raise
        delay = min(30, 2 ** attempt) + random.uniform(0, 1)
        time.sleep(delay)

resp = chat_with_retry(
    [{"role": "user", "content": "Give me three names for a tavern."}],
    max_tokens=100,
)
print(resp.choices[0].message.content)

สิ่งที่เทียบเท่าด้วย raw fetch ใน Node.js:

const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function chatWithRetry(body, maxAttempts = 5) {
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
    const res = await fetch("https://api.uncensoredaiapis.com/v1/chat/completions", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${process.env.API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ model: "uncensored", ...body }),
    });

    if (res.ok) return res.json();

    const retryable = res.status === 429 || res.status === 503;
    if (!retryable || attempt === maxAttempts - 1) {
      throw new Error(`HTTP ${res.status}: ${await res.text()}`);
    }
    const delay = Math.min(30000, 2 ** attempt * 1000) + Math.random() * 1000;
    await sleep(delay);
  }
}

const data = await chatWithRetry({
  messages: [{ role: "user", content: "Give me three names for a tavern." }],
  max_tokens: 100,
});
console.log(data.choices[0].message.content);

หากคุณเจอ 429 บ่อยๆ วิธีแก้ไขที่ดีกว่าคือการใช้ขีดจำกัดความพร้อมใช้งานแบบ client-side เล็กน้อย (semaphore หรือคิวที่มี worker ห้าถึงสิบตัว) แทนการนอนหลับนานขึ้น ที่ 300 คำขอต่อนาที คุณสามารถรองรับคำขอห้าคำต่อวินาที ซึ่งเพียงพอสำหรับแอปพลิเคชันส่วนใหญ่

สถานะการสนทนาหลายรอบ

API ไม่มีสถานะ (stateless) ไม่บันทึกคำขอเดิม ดังนั้นทุกการเรียกใช้ต้องรวมประวัติที่คุณต้องการให้โมเดลเห็นไว้ด้วย ให้เก็บรายการข้อความ เพิ่มการตอบกลับของผู้ใช้ เรียก API เพิ่มการตอบกลับของผู้ช่วย แล้วทำซ้ำ ข้อความระบบที่ index 0 จะเก็บบุคลิกหรือคำสั่งไว้ และจะถูกส่งทุกครั้ง

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
)

messages = [
    {"role": "system", "content": "You are a dry-witted ship's AI. Keep replies under 80 words."}
]

def say(text: str) -> str:
    messages.append({"role": "user", "content": text})
    resp = client.chat.completions.create(
        model="uncensored", messages=messages, max_tokens=300
    )
    reply = resp.choices[0].message.content
    messages.append({"role": "assistant", "content": reply})
    return reply

print(say("We just lost the main engine. Options?"))
print(say("Which of those is the least risky?"))

เนื่องจากประวัติทั้งหมดจะถูกส่งใหม่ ต้นทุนอินพุตจะเพิ่มขึ้นในแต่ละรอบ หน้าต่างบริบทมีขนาด 100,000 โทเคน และครอบคลุมทั้งพรอมต์และการสร้างผลลัพธ์รวมกัน ดังนั้นเซสชันที่ยาวมากจะส่งกลับข้อผิดพลาด 400 เมื่อพรอมต์เกินขีดจำกัด ส่วนถ้า prompt + max_tokens เกิน การตอบกลับจะหยุดที่สุดหน้าต่างเท่านั้น กลยุทธ์ทั่วไปคือการลบคู่ผู้ใช้และผู้ช่วยที่เก่าที่สุดออก ในขณะที่รักษาข้อความระบบไว้เสมอ หรือการขอให้โมเดลสรุปการสนทนาเก่าให้เป็นข้อความสั้นๆ แล้วแทนที่ด้วยข้อความนั้น เก็บประวัติในฐานข้อมูลของคุณเองโดยมี conversation id เป็นคีย์ เพื่อให้การเริ่มใหม่ไม่สูญเสียการสนทนา สำหรับตัวอย่างของเซสชันที่ยาวพร้อมประมาณการต้นทุนที่แท้จริง ดู use cases page

การควบคุมค่าใช้จ่ายด้วย max_tokens

ราคาอยู่ที่ $0.15 ต่อโทเคนอินพุตล้านตัว และ $0.50 ต่อโทเคนเอาต์พุตล้านตัว โดยหักจากยอดเงินที่เติมไว้ล่วงหน้า เอาต์พุตมีราคาแพงกว่าอินพุตประมาณ 3.3 เท่า และ max_tokens คือขีดจำกัดของเอาต์พุตสำหรับคำขอหนึ่งรายการ ซึ่งเป็นค่าที่ไม่บังคับ หากไม่ได้ตั้งค่า การตอบกลับอาจยาวไปจนสุดหน้าต่างบริบท (context window) การตั้งค่าอย่างชัดเจนเป็นวิธีการควบคุมต้นทุนที่ง่ายที่สุดที่คุณมี

การคำนวณกรณีเลวร้ายช่วยได้ หากคุณไม่กำหนดขีดจำกัดเอาต์พุต การตอบกลับอาจยาวถึงขอบเขตของ context window ได้ ดังนั้นต้นทุนของเอาต์พุตเพียงอย่างเดียวอาจสูงถึง 100,000 × $0.50 / 1,000,000 = $0.05 หากคุณตั้งค่า max_tokens เป็น 300 สำหรับการตอบแชท กรณีเลวร้ายจะลดลงเหลือ $0.00015 การสนทนาทั่วไปที่มีโทเคนอินพุต 1,500 และโทเคนเอาต์พุต 300 มีต้นทุนประมาณ $0.000225 บวก $0.00015 ซึ่งต่ำกว่า $0.001

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.uncensoredaiapis.com/v1",
    api_key=os.environ["API_KEY"],
)

INPUT_PER_M = 0.25
OUTPUT_PER_M = 1.00

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise the plot of Hamlet in 5 sentences."}],
    max_tokens=250,
)

u = resp.usage
cost = u.prompt_tokens * INPUT_PER_M / 1_000_000 + u.completion_tokens * OUTPUT_PER_M / 1_000_000
print(f"in={u.prompt_tokens} out={u.completion_tokens} cost=${cost:.6f}")
print("finish_reason:", resp.choices[0].finish_reason)

สังเกต finish_reason ค่า length หมายถึงการตอบกลับถึงขีดจำกัดของคุณและถูกตัดออก; หากเกิดขึ้นบ่อยๆ ให้เพิ่มขีดจำกัดหรือขอผลลัพธ์ที่สั้นลงในพรอมต์ เนื่องจากขีดจำกัดเพียงอย่างเดียวจะตัดข้อความออกแทนที่จะทำให้โมเดลกระชับ จับคู่ขีดจำกัดกับคำแนะนำเช่นจำนวนคำเป้าหมาย และบันทึก usage สำหรับการเรียกใช้ทุกครั้งเพื่อดูค่าเฉลี่ยจริงแทนการคาดเดา เครดิตทดลองใช้ฟรีและรายละเอียดยอดคงเหลือของคุณอยู่ที่ pricing page

ถาม-ตอบ

ฉันต้องการ SDK พิเศษสำหรับ API AI แบบไม่เซ็นเซอร์นี้หรือไม่

ไม่ใช่ แพ็กเกจ openai สำหรับ Python (v1+) และแพ็กเกจ openai สำหรับ npm (v4+) ทำงานได้ ตั้ง base_url เป็น https://api.uncensoredaiapis.com/v1, แล้วระบุคีย์ของคุณ และใช้ id ของโมเดล uncensored

การสตรีมมิงนับการใช้งานโทเคนด้วยหรือไม่

ใช่ เมื่อใช้ stream: true API จะเพิ่ม chunk สุดท้ายที่ส่งข้อมูลการใช้งานโดยอัตโนมัติ chunk นี้มี choices array ว่างเปล่า ดังนั้นให้ตรวจสอบว่า choices มีอยู่ก่อนอ่าน delta

ข้อผิดพลาดใดที่โค้ดของฉันควรลองใหม่?

ลองใหม่เมื่อเจอ 429 (ขีดจำกัดอัตรา, 300 คำขอต่อนาทีต่อคีย์) และ 503 upstream_busy ด้วย exponential backoff และ jitter อย่าลองใหม่กับ 400, 401, 402 หรือ 403 เพราะคำขอเดิมจะล้มเหลวอีกครั้ง

ประวัติการสนทนาจะถูกจัดเก็บไว้ให้ฉันระหว่างคำขอหรือไม่

ไม่ แต่ละคำขอเป็นอิสระต่อกัน ดังนั้นคุณต้องส่งรายการ messages ทั้งหมดทุกครั้ง หน้าต่างบริบทรองรับ 100,000 โทเคนสำหรับพรอมต์และการตอบกลับรวมกัน

คีย์ของคุณอยู่ห่างแค่แบบฟอร์มเดียว

สร้างบัญชี คัดลอกคีย์ และเปลี่ยน base URL นั่นคือการตั้งค่าทั้งหมด