API Reference
Complete API documentation
Base URL
https://api.thistoken.aiAuthentication
All API requests must include the API Key in the Authorization header:
Authorization: Bearer YOUR_API_KEYEndpoints
POST
/v1/chat/completionsCreate a chat completion
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name, e.g. gpt-4o, claude-3.5-sonnet |
| messages | array | Yes | Array of messages with role and content |
| temperature | number | No | Sampling temperature, 0-2, default 1 |
| max_tokens | integer | No | Maximum tokens to generate |
| stream | boolean | No | Stream the response, default false |
Example Request
curl https://api.thistoken.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'POST
/v1/embeddingsCreate text embeddings
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Embedding model name, e.g. text-embedding-3-small |
| input | string|array | Yes | Text to embed |
Example Request
curl https://api.thistoken.ai/v1/embeddings \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "Hello world"
}'GET
/v1/modelsGet the list of available models
Example Request
curl https://api.thistoken.ai/v1/models \
-H "Authorization: Bearer $API_KEY"POST
/v1/images/generationsGenerate images
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Image model, e.g. dall-e-3 |
| prompt | string | Yes | Image description |
| size | string | No | Image size, e.g. 1024x1024 |
Example Request
curl https://api.thistoken.ai/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "dall-e-3",
"prompt": "A cute cat",
"size": "1024x1024"
}'Error Codes
| Code | Description |
|---|---|
| 400 | Invalid request parameters |
| 401 | Authentication failed — invalid API Key |
| 402 | Insufficient balance |
| 429 | Rate limit exceeded |
| 500 | Internal server error |