Chat & Response Endpoints
OpenAI-compatible chat. Follow the examples below with your platform API Key.
1. Chat Completions
- Path:
/v1/chat/completions - Request Method:
POST
Core Request Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Target model name, e.g., gpt-4o, claude-3-5-sonnet-20241022, gemini-1.5-pro |
messages | array | Yes | Array of historical conversation messages, e.g., [{"role": "user", "content": "Hello"}] |
stream | boolean | No | Whether to return the response as an SSE event stream (streaming character-by-character, default is false) |
temperature | number | No | Sampling temperature (0~2). Higher values increase randomness. Recommended: 0.7 to 1.0 |
max_tokens | integer | No | Maximum token limit for model generation |
tools | array | No | List of tools (Function Calling) available for the model |
Command Line Example (Curl)
curl -X POST https://www.tokenpad.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your_token" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Please explain what quantum entanglement is."}
],
"stream": false
}'
2. Responses API
- Path:
/v1/responses - Request Method:
POST
[!NOTE] Use
/v1/responseswhen your client already speaks the Responses payload format. Billing, quotas, and usage logs still apply.
Request Example
{
"model": "gpt-4o",
"input": [
{"role": "user", "content": "Pass-through request content"}
],
"stream": false
}