Skip to main content
POST
cURL
Call OpenAI-compatible Chat Completions with POST https://www.bettertoken.ai/v1/chat/completions. Most external tools take the Base URL https://www.bettertoken.ai/v1 and append /chat/completions themselves.

Key settings

Prerequisites

Install

curl needs no SDK. Confirm that curl --version works in your terminal.

Manual setup

curl

Python SDK

JavaScript SDK

Verify the connection

In the Playground on the right:
  1. Enter YOUR_API_KEY under Authorization.
  2. Replace model with YOUR_MODEL_ID.
  3. Edit messages and send the request.
The Playground already uses the complete URL https://www.bettertoken.ai/v1/chat/completions. A 200 response with model output in choices[0].message.content confirms the connection.

Switch models

Replace YOUR_MODEL_ID with the complete Model ID from the model plaza or Setup dialog. Do not shorten the Model ID based on its display name.

Common errors

Advanced setup

Supported providers

Statuses apply to the BetterToken setup documented on this page.
  • Manual setup: enter the API Key, Base URL, and Model.
  • Not supported: no verified direct setup is currently available.

Technical details

Tools that require a complete request URL, such as GitHub Copilot and TRAE, use https://www.bettertoken.ai/v1/chat/completions. Tools that append the path themselves, such as Cursor, Cline, OpenCode, n8n, and Dify, use only https://www.bettertoken.ai/v1.

Authorizations

Authorization
string
header
required

Use your BetterToken API Key as a bearer token. Do not expose API keys in frontend browser code, screenshots, logs, tickets, or Git repositories.

Body

application/json
model
string
required

GPT 提供商中可用的模型 ID。请以模型广场当前显示的模型为准。

Example:

"YOUR_MODEL_ID"

messages
object[]
required

对话消息数组。每项应包含 role 和 content。

Minimum array length: 1
stream
boolean
default:false

是否请求流式响应。

Response

GPT 提供商模型返回的 Chat Completions API 响应。

OpenAI-compatible Chat Completions API 响应。实际字段会随所选模型和请求参数变化。