API Reference

Complete API documentation

Base URL

https://api.thistoken.ai

Authentication

All API requests must include the API Key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Endpoints

POST/v1/chat/completions

Create a chat completion

Parameters

NameTypeRequiredDescription
modelstringYesModel name, e.g. gpt-4o, claude-3.5-sonnet
messagesarrayYesArray of messages with role and content
temperaturenumberNoSampling temperature, 0-2, default 1
max_tokensintegerNoMaximum tokens to generate
streambooleanNoStream 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/embeddings

Create text embeddings

Parameters

NameTypeRequiredDescription
modelstringYesEmbedding model name, e.g. text-embedding-3-small
inputstring|arrayYesText 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/models

Get the list of available models

Example Request

curl https://api.thistoken.ai/v1/models \
  -H "Authorization: Bearer $API_KEY"
POST/v1/images/generations

Generate images

Parameters

NameTypeRequiredDescription
modelstringYesImage model, e.g. dall-e-3
promptstringYesImage description
sizestringNoImage 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

CodeDescription
400Invalid request parameters
401Authentication failed — invalid API Key
402Insufficient balance
429Rate limit exceeded
500Internal server error