Get up and running with our API in minutes. Follow this guide to create your account, generate an API key, and make your first ** request.**
Sign up in seconds to access your personal dashboard and start building.
Create secure keys to authenticate your API requests instantly.
Here's a complete example showing how to execute a message request. Replace
<YOUR_API_KEY> with your actual API key.
POST request to /api/v1/messages
curl -X POST "https://api.tokenthon.com/api/v1/messages" \
-H "Content-Type: application/json" \
-H "x-api-key: <YOUR_API_KEY>" \
-d '{
"model": "gpt-auto",
"messages": [{
"role": "user",
"content": "Write a one-sentence bedtime story about a unicorn."
}],
"response_format": { "format": "text" },
"message_cache_ttl": 300,
"timeout": 90
}'Request Parameters Explained
modelThe AI model to use. gpt-auto automatically selects the best model.
messagesArray of conversation messages with role and content. Supports four roles: system, developer, assistant, and user.message_cache_ttlCache duration in seconds (default: 300).timeoutMaximum execution time in seconds (default: 90).All Tokenthon models support a comprehensive multi-role message system for richer conversations:
| Role | Description |
|---|---|
system | High-level system instructions that set overall AI behavior and personality |
developer | Developer-provided instructions for task-specific guidance or formatting requirements |
assistant | AI-generated responses, used to maintain conversation history |
user | End-user messages and queries (at least one required) |
curl -X POST "https://api.tokenthon.com/api/v1/messages" \
-H "Content-Type: application/json" \
-H "x-api-key: <YOUR_API_KEY>" \
-d '{
"model": "gpt-auto",
"messages": [
{
"role": "system",
"content": "You are a helpful coding assistant."
},
{
"role": "developer",
"content": "Provide code examples in TypeScript. Keep responses concise."
},
{
"role": "user",
"content": "How do I create a simple function in TypeScript?"
}
],
"response_format": { "format": "text" }
}'All models (gpt-auto, gpt-5, gpt-5.2, and gpt-5-mini) fully support the four-role system.
When you make a request to the API, you'll receive a JSON response with the following structure:
Typical JSON response from the execute endpoint
{
"success": true,
"data": {
"job_id": "c07748a4-7545-4d8d-8c9f-cc759a965d39",
"status": "completed",
"created_at": 1760814494529,
"result": {
"response_content": "Under a blanket of twinkling stars, a gentle unicorn named Luma painted the night sky with shimmering dreams so every child could fall asleep smiling."
}
},
"message": "Job result retrieved successfully"
}API responses are cached for 10–60 minutes to optimize retries and polling operations.
Ready to build something amazing?
View API Reference