ไม่ต้อง KYC — ไม่ต้องใช้บัตรประชาชน ไม่ต้องเซลฟี่ ไม่ต้องใช้เอกสาร จ่ายด้วยคริปโต: BTC, USDT, USDC, ETH, SOL, LTC
ภาษา: ไทย
รับ API key

เอกสาร · API reference

Chat completions endpoint: POST /api/v1/chat/completions

endpoint เดียวตอบทุกโมเดล รับ body เดียวกับ OpenAI chat completions API และคืนออบเจกต์เดียวกัน ดังนั้นการเชื่อมต่อที่มีอยู่แล้วเพียงต้องการ base URL ใหม่, key ใหม่ และ model id จากรายการของเรา

อัปเดตล่าสุด: · 4 นาทีในการอ่าน

คำตอบสั้น

chat completions endpoint ของ LLMwithCrypto รับฟิลด์ใดบ้าง?

รับ body ของ OpenAI chat completions: model และ messages จำเป็น; max_tokens, temperature, top_p, stop, stream, stream_options, tools, tool_choice และ response_format เป็นตัวเลือก LLMwithCrypto คืนออบเจกต์ chat.completion พร้อมจำนวน usage คิดค่าบริการต่อโทเค็นจากเครดิตของคุณ ตามที่ระบุไว้ในเอกสารเมื่อ 23 ตุลาคม 2026 การเรียก tool และ JSON output ขึ้นอยู่กับโมเดล

endpoint โดยสรุป

Method และ URLPOST https://llmwithcrypto.com/api/v1/chat/completions
การยืนยันตัวตนส่ง API key ของคุณเป็น Bearer token ใน Authorization header เหมือนที่ OpenAI SDK ทำ
BodyJSON, Content-Type: application/json
Responseออบเจกต์ chat.completion หรือ server-sent events ด้วย stream: true
การเรียกเก็บเงินคุณจ่ายต่อ token จากยอดคงเหลือ: input และ output tokens ถูกนับด้วย tokenizer ของโมเดลนั้นเองและคิดตามราคาของโมเดลนั้นต่อ 1M tokens การเรียกที่จบด้วย error ไม่มีค่าใช้จ่าย
ฟีเจอร์Streaming ใช้ได้กับทุกโมเดล; tool calling และ JSON output ขึ้นอยู่กับสิ่งที่แต่ละโมเดลรองรับเอง

สร้าง chat completion

POST/api/v1/chat/completions

ส่งบทสนทนาไปยังโมเดลหนึ่งและคืนคำตอบพร้อมจำนวนโทเค็น ตัวอย่างถามคำถามสั้นๆ กับ DeepSeek V4 Pro โดยจำกัด 200 โทเค็น; id, เวลา และจำนวนใน response เป็นเพียงตัวอย่าง

การยืนยันตัวตน: API key ใน header Authorization: Bearer API_KEY

Request body

ฟิลด์ประเภทจำเป็นคำอธิบาย
modelstringใช่model id เช่น deepseek-v4-pro หรือ gpt-oss-120b GET /api/v1/models คืนทุก id ที่ key ของคุณเรียกได้
messagesobject[]ใช่บทสนทนา เรียงจากเก่าสุดก่อน แต่ละรายการมี role (system, user, assistant หรือ tool) และสตริง content; ข้อความ tool ยังมี tool_call_id ด้วย
max_tokensintegerไม่ใช่จำนวนโทเค็นสูงสุดที่คำตอบใช้ได้ หากไม่ระบุ โมเดลอาจเขียนจน context window เต็ม และคุณจ่ายทุกโทเค็นที่มันเขียน
temperaturenumberไม่ใช่0 ถึง 2 ค่ายิ่งต่ำยิ่งคาดเดาได้ ค่ายิ่งสูงยิ่งหลากหลาย ค่าเริ่มต้นขึ้นอยู่กับโมเดล
top_pnumberไม่ใช่0 ถึง 1, nucleus sampling เปลี่ยน temperature หรือ top_p อย่างใดอย่างหนึ่ง ไม่ใช่ทั้งสอง
stopstring or string[]ไม่ใช่สูงสุด 4 sequence ที่สิ้นสุดคำตอบเมื่อโมเดลเขียนมัน ไม่รวมอยู่ในคำตอบ
streambooleanไม่ใช่true ส่งคำตอบเป็น server-sent events ทีละส่วน ดู streaming
stream_optionsobjectไม่ใช่{"include_usage": true} เพิ่ม event สุดท้ายพร้อม usage ของการเรียกแบบ streamed
toolsobject[]ไม่ใช่ฟังก์ชันที่โมเดลอาจขอให้คุณเรียก ในรูปแบบ OpenAI ใช้ได้กับโมเดลที่รองรับ tool calling ดู tool calling
tool_choicestring or objectไม่ใช่auto (ค่าเริ่มต้นเมื่อตั้ง tools), none, required หรือ {"type": "function", "function": {"name": "…"}}
response_formatobjectไม่ใช่{"type": "json_object"} ขอออบเจกต์ JSON ที่ถูกต้อง บนโมเดลที่รองรับ ระบุใน prompt ของคุณว่า JSON ควรมีอะไรบ้าง
ตัวอย่าง: a short answer from DeepSeek V4 Pro
{
  "model": "deepseek-v4-pro",
  "messages": [
    {
      "role": "system",
      "content": "Answer in two sentences."
    },
    {
      "role": "user",
      "content": "What is a context window?"
    }
  ],
  "max_tokens": 200
}
ตัวอย่าง: a JSON object from gpt-oss-120b, low temperature
{
  "model": "gpt-oss-120b",
  "messages": [
    {
      "role": "user",
      "content": "Return {\"city\": string, \"country\": string} for the Eiffel Tower."
    }
  ],
  "response_format": {
    "type": "json_object"
  },
  "temperature": 0.2,
  "max_tokens": 100
}

Response 200

{
  "id": "chatcmpl-8f2c41d0a7b94e1c",
  "object": "chat.completion",
  "created": 1792742400,
  "model": "deepseek-v4-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A context window is the maximum number of tokens a model can read and write in one request. Anything beyond it must be cut or summarized before the call."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 34,
    "total_tokens": 61
  }
}

ตัวอย่างโค้ด

curl
curl -s "https://llmwithcrypto.com/api/v1/chat/completions" \
  -H "Authorization: Bearer $LLMWITHCRYPTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "Answer in two sentences."},
      {"role": "user", "content": "What is a context window?"}
    ],
    "max_tokens": 200
  }'
Python
import os

from openai import OpenAI

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

resp = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "system", "content": "Answer in two sentences."},
        {"role": "user", "content": "What is a context window?"},
    ],
    max_tokens=200,
)
print(resp.choices[0].message.content)
print(resp.usage.prompt_tokens, "in,", resp.usage.completion_tokens, "out")
Node.js
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://llmwithcrypto.com/api/v1',
  apiKey: process.env.LLMWITHCRYPTO_API_KEY,
});

const resp = await client.chat.completions.create({
  model: 'deepseek-v4-pro',
  messages: [
    { role: 'system', content: 'Answer in two sentences.' },
    { role: 'user', content: 'What is a context window?' },
  ],
  max_tokens: 200,
});
console.log(resp.choices[0].message.content);
console.log(resp.usage.prompt_tokens, 'in,', resp.usage.completion_tokens, 'out');

ฉันเขียน messages อย่างไร?

ส่งบทสนทนาทั้งหมดทุกครั้ง โดยเริ่มจากข้อความเก่าสุด: API ไม่เก็บความจำระหว่างการเรียก และไม่มีข้อมูลใดจากพรอมป์ของคุณถูกจัดเก็บ เราไม่เก็บ prompts ของคุณหรือคำตอบของโมเดล: เมื่อส่งคำตอบแล้ว ข้อความนั้นก็หายไป แต่ละครั้งที่เรียกจะเหลือ log หนึ่งบรรทัดซึ่งมีเวลา บัญชี โมเดล และจำนวน token แล้วลบออกหลัง 30 วัน.

  • system: คำสั่งที่กำหนดกรอบทุกคำตอบ เช่น โทน ภาษา หรือรูปแบบผลลัพธ์ ใส่ไว้บนสุดหนึ่งรายการ
  • user: สิ่งที่ผู้ใช้หรือโปรแกรมของคุณถาม
  • assistant: คำตอบก่อนหน้าของโมเดล เพื่อให้มันสนทนาต่อได้
  • tool: ผลลัพธ์ของฟังก์ชันที่โมเดลขอให้คุณรัน พร้อม tool_call_id ที่มันให้มา

ทุกข้อความนับเป็น input tokens ประวัติยาวจึงมีค่าใช้จ่ายมากขึ้นในแต่ละรอบ ตัดทอนหรือสรุปเทิร์นเก่าเมื่อบทสนทนายาวขึ้น

คำขอหนึ่งยาวได้แค่ไหน?

input และ output รวมกันต้องพอดีกับ context window ของโมเดล ณ วันที่ 23 ตุลาคม 2026 DeepSeek V4 Pro อ่านได้ถึง 1M tokens, gpt-oss-120b ถึง 128K และ Qwen3 235B ถึง 256K; หน้ารุ่นโมเดล แสดงรายการทั้งหมด

คำขอที่ไม่พอดีจะตอบกลับเป็น 400 พร้อมโค้ด context_length_exceeded และไม่มีค่าใช้จ่าย ตั้งค่า max_tokens เพื่อให้พรอมป์บวกคำตอบยาวสุดที่คุณรับได้ยังอยู่ในหน้าต่าง

finish_reason บอกอะไรฉัน?

finish_reasonความหมายสิ่งที่ต้องทำ
stopโมเดลจบคำตอบแล้ว หรือเขียนหนึ่งใน stop sequences ของคุณไม่ต้องทำอะไร: คำตอบสมบูรณ์แล้ว
lengthคำตอบถึง max_tokens หรือ context windowเพิ่ม max_tokens หรือขอคำตอบที่สั้นลง
tool_callsโมเดลต้องการให้คุณรันฟังก์ชันหนึ่งหรือหลายฟังก์ชันรันแล้วส่งผลลัพธ์กลับ ดู tool calling

พารามิเตอร์ OpenAI ตัวใดที่ไม่รองรับ?

ฟิลด์ในตารางข้างต้นคือข้อตกลงทั้งหมด ฟิลด์อื่นจาก OpenAI API เช่น n (หลายคำตอบต่อการเรียก), logprobs, audio หรือ image inputs ไม่รองรับ: ส่งเฉพาะฟิลด์ที่ระบุไว้ที่นี่ โมเดลเป็น text models ไม่มีตัวใดรับรูปภาพผ่าน endpoint นี้

ฟิลด์ model รับเฉพาะ id ในรายการของเราเท่านั้น เราไม่ขายการเข้าถึง GPT, Claude, Gemini หรือ Grok: ผู้ผลิตห้ามขายต่อการเข้าถึง API โดยไม่ได้รับอนุมัติจากพวกเขา และเราไม่ได้รับอนุมัติดังกล่าว.

Chat completions: คำถามที่พบบ่อย

มี legacy completions endpoint ไหม?

ไม่มี มีเฉพาะรูปแบบ chat; พรอมป์เดียวคือ array messages ที่มีข้อความ user หนึ่งข้อความ

การเรียกหนึ่งครั้งมีค่าใช้จ่ายเท่าไร?

คุณจ่ายต่อ token จากยอดคงเหลือ: input และ output tokens ถูกนับด้วย tokenizer ของโมเดลนั้นเองและคิดตามราคาของโมเดลนั้นต่อ 1M tokens การเรียกที่จบด้วย error ไม่มีค่าใช้จ่าย. ราคาต่อโมเดลอยู่ในหน้าราคา.

ดูคำขอที่ผ่านมาของฉันได้ไหม?

ไม่ได้ ตามการออกแบบ เราไม่เก็บ prompts ของคุณหรือคำตอบของโมเดล: เมื่อส่งคำตอบแล้ว ข้อความนั้นก็หายไป แต่ละครั้งที่เรียกจะเหลือ log หนึ่งบรรทัดซึ่งมีเวลา บัญชี โมเดล และจำนวน token แล้วลบออกหลัง 30 วัน.

ทำไมคำตอบของฉันหยุดกลางคัน?

finish_reason จะเป็น length: คำตอบชน max_tokens เพิ่มค่านั้นภายใน context window ของโมเดล

DeepSeek V4 Pro เริ่มต้น $1.254 ต่อ 1M input tokens · ไม่ต้อง KYC

รับ API key