cURL
API Reference
OpenAI Chat Completions API
Use BetterToken’s OpenAI-compatible Chat Completions API with a complete request URL, Bearer API Key, curl, Python, and JavaScript examples.
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
- Create a BetterToken API Key
- Copy a Model ID from the model plaza or the key Setup dialog
- Prepare a terminal with
curl, or Python 3 / Node.js
Install
- curl
- Python
- JavaScript
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:- Enter
YOUR_API_KEYunder Authorization. - Replace
modelwithYOUR_MODEL_ID. - Edit
messagesand send the request.
https://www.bettertoken.ai/v1/chat/completions.
A 200 response with model output in choices[0].message.content confirms the connection.
Switch models
ReplaceYOUR_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.
What the setup methods mean
What the setup methods mean
- Manual setup: enter the API Key, Base URL, and Model.
- Not supported: no verified direct setup is currently available.
Technical details
Base URL and full request URL
Base URL and full request URL
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
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
Response
GPT 提供商模型返回的 Chat Completions API 响应。
OpenAI-compatible Chat Completions API 响应。实际字段会随所选模型和请求参数变化。

