AITextGen API
AITextGen API provides advanced AI-powered text generation capabilities for various applications. Leverage state-of-the-art language models to generate human-like text, complete sentences, or even entire paragraphs based on given prompts.
Subscribe to API View Full DocumentationQuick Start
const apiKey = 'your_api_key_here';
const prompt = 'Once upon a time';
fetch('https://api.cryptid.finance/v1/aitextgen/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
prompt: prompt,
max_length: 100,
temperature: 0.7
})
})
.then(response => response.json())
.then(data => console.log(data.generated_text))
.catch(error => console.error('Error:', error));
Endpoint
POST https://api.cryptid.finance/v1/aitextgen/generate
Parameters
Parameter | Type | Description |
---|---|---|
prompt | string | The input text to start the generation from |
max_length | integer | The maximum length of the generated text (default: 50) |
temperature | float | Controls randomness in generation (0.0 to 1.0, default: 0.7) |
top_p | float | Nucleus sampling parameter (0.0 to 1.0, default: 0.9) |
Response
{
"generated_text": "Once upon a time, in a lush green forest, there lived a curious rabbit named Hoppy. He had always dreamed of exploring the world beyond the trees, but fear had held him back. One day, Hoppy decided to be brave and venture out...",
"tokens_generated": 42,
"generation_time": 0.8765
}
Error Codes
Code | Description |
---|---|
400 | Bad Request - Check the request parameters |
401 | Unauthorized - Invalid API key |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error - Please try again later |