Skip to content

API Request Test

Open Linux Shell or Windows CMD terminal and paste the following command to run your first API request. Make sure to replace YOUR_API_KEY with your API key.

curl Request Example

bash
curl https://ai-tokenhub.com/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
  "model": "qwen3.5-plus",
  "messages": [{"role": "user", "content": "Say this is a test!"}],
  "temperature": 0.7
}'

Response Example

This request asks the model to complete the prompt "Say this is a test!" using the qwen3.5-plus model. You should receive a response similar to the following:

json
{
   "id":"chatcmpl-abc123",
   "object":"chat.completion",
   "created":1677858242,
   "model":"qwen3.5-plus",
   "usage":{
      "prompt_tokens":13,
      "completion_tokens":7,
      "total_tokens":20
   },
   "choices":[
      {
         "message":{
            "role":"assistant",
            "content":"\n\nThis is a test!"
         },
         "finish_reason":"stop",
         "index":0
      }
   ]
}

Response Field Description

FieldDescription
idUnique identifier for the request
objectReturn object type, here is chat.completion
createdUnix timestamp of request creation time
modelActual model name processed
usageToken usage statistics
choicesList of model-generated responses
finish_reasonGeneration completion reason, stop means normal completion

Now you have completed your first chat request. finish_reason being stop means the API returned the complete output generated by the model.