Your request cannot be billed. This can happen when you run out of prepaid words and either (a) you haven’t accepted pay-as-you-go terms (legacy accounts), (b) you don’t have a saved payment method, (c) your account is past due, or (d) billing is temporarily delayed.
Solution: Verify that you’re including the correct API token in the api-token header. Check your StealthGPT dashboard under the “API Key” tab for the correct token.
{ "message": "The text exceeds the 3,000 word limit"}
Solution: Keep your prompt text under 3,000 words.
Not Enough Credits
Error: 402 Payment RequiredResponse:
{ "message": "Payment required or payment method not set up"}
Solution:
If you are out of prepaid words, you can:
Add prepaid words, or
Set up pay-as-you-go billing (saved payment method) and accept the updated pay-as-you-go terms (legacy accounts)
For the /api/stealthify/articles endpoint, the request may bill to pay-as-you-go when prepaid is insufficient. If pay-as-you-go is not available, you will receive a 402.
Result Not Available
Error: 403 ForbiddenResponse:
{ "message": "Result is not available"}
Solution: This typically occurs with the articles endpoint when there was an issue generating the article. Try again with a different prompt.
Error: 429 Too Many RequestsSolution: Implement request throttling in your application and avoid making too many requests in a short period.
# Python example with retry logicimport requestsimport timedef call_api_with_retry(url, headers, data, max_retries=3, retry_delay=5): for attempt in range(max_retries): response = requests.post(url, headers=headers, json=data) if response.status_code == 429: # Wait before retrying time.sleep(retry_delay) continue return response return response # Return last response if all retries failed
Implement Retry Logic: For transient errors (like 429 or 500), implement retry logic with exponential backoff.
Validate Inputs: Validate all parameters before sending requests to avoid 400 errors.
Check Response Status: Always check the HTTP status code before trying to process the response.
Error Logging: Log detailed error information for troubleshooting.
Handle Errors Gracefully: Provide user-friendly error messages in your application rather than exposing raw API errors.
// Node.js example of comprehensive error handlingasync function callStealthGPT(prompt, rephrase) { try { const response = await axios.post('https://stealthgpt.ai/api/stealthify', { prompt, rephrase, detector: 'turnitin' }, { headers: { 'api-token': process.env.API_TOKEN, 'Content-Type': 'application/json' } }); return response.data; } catch (error) { // Handle different error types if (error.response) { // The request was made and server responded with an error code const errorMessage = error.response.data.message || 'Unknown error'; switch (error.response.status) { case 400: console.error('Invalid request parameters:', error.response.data); throw new Error(`Invalid request: ${errorMessage}`); case 401: console.error('Authentication failed'); throw new Error('API authentication failed. Please check your API token.'); case 402: console.error('Payment required'); throw new Error(`Payment required: ${errorMessage}`); case 403: console.error('Forbidden'); throw new Error(`Operation not allowed: ${errorMessage}`); case 429: console.error('Rate limit exceeded'); throw new Error('Too many requests. Please try again later.'); default: console.error(`Error ${error.response.status}:`, error.response.data); throw new Error('An error occurred while processing your request.'); } } else if (error.request) { // The request was made but no response received console.error('No response received:', error.request); throw new Error('No response from server. Please check your connection.'); } else { // Something else caused the error console.error('Error setting up request:', error.message); throw new Error('Failed to send request.'); } }}