Documentation Index
Fetch the complete documentation index at: https://docs.artificialstudio.ai/llms.txt
Use this file to discover all available pages before exploring further.
The API uses standard HTTP status codes and returns errors in a consistent JSON format.
All errors return a JSON body with a message field:
{
"message": "Error message describing what went wrong"
}
Validation errors include additional detail:
{
"message": "Validation failed",
"errors": [
{ "field": "tool", "message": "Required", "code": "invalid_type" }
]
}
Status codes
Client errors (4xx)
| Status | Name | When it happens |
|---|
| 400 | Bad Request | Invalid JSON, missing fields, invalid values, unknown fields |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Not enough credits |
| 403 | Forbidden | Trying to access another user’s resource |
| 404 | Not Found | Invalid endpoint, tool, model, or generation ID |
| 429 | Too Many Requests | Rate limit exceeded |
Server errors (5xx)
| Status | Name | What to do |
|---|
| 500 | Internal Server Error | Retry after a few seconds |
| 502 | Bad Gateway | Retry after a few seconds |
| 503 | Service Unavailable | Service is temporarily down, retry later |
Handling errors
const generate = async (tool, input) => {
const response = await fetch('https://api.artificialstudio.ai/api/run', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'YOUR_API_KEY'
},
body: JSON.stringify({ tool, input })
});
if (!response.ok) {
const error = await response.json();
switch (response.status) {
case 401:
throw new Error('Invalid API key');
case 402:
throw new Error('Insufficient credits');
case 429:
throw new Error('Rate limit exceeded. Retry later.');
default:
throw new Error(error.message || 'Request failed');
}
}
return response.json();
};
Common errors and solutions
Invalid API key (401)
{ "message": "Authorization header is required" }
Check that your API key is correct and included in the Authorization header. Do not use the Bearer prefix.
Insufficient credits (402)
{ "message": "You do not have enough credits to perform this action" }
Add credits at Account Settings.
{ "message": "Tool not found" }
Verify the tool slug. Use GET /api/tools to list available tools.
Rate limit exceeded (429)
{ "message": "Too many API requests, please try again later" }
Wait before retrying. See rate limits for details on your plan’s limits.
Validation error (400)
{
"message": "Validation failed",
"errors": [
{ "field": "tool", "message": "Required", "code": "invalid_type" }
]
}
Check the required parameters for your tool. The API rejects unknown fields — only send documented parameters.