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

ParameterTypeRequiredDescription
modelstringYesTarget model name, e.g., gpt-4o, claude-3-5-sonnet-20241022, gemini-1.5-pro
messagesarrayYesArray of historical conversation messages, e.g., [{"role": "user", "content": "Hello"}]
streambooleanNoWhether to return the response as an SSE event stream (streaming character-by-character, default is false)
temperaturenumberNoSampling temperature (0~2). Higher values increase randomness. Recommended: 0.7 to 1.0
max_tokensintegerNoMaximum token limit for model generation
toolsarrayNoList 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/responses when 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
} 

Raw Markdown (.md) · llms.txt