AITextGen API Documentation

Introduction

The AITextGen API provides advanced AI-powered text generation capabilities. This documentation covers all aspects of integrating and using the API in your applications.

Authentication

To use the AITextGen API, you need to include your API key in the Authorization header of your requests:

Authorization: Bearer YOUR_API_KEY

Base URL

All API requests should be made to:

https://api.cryptid.finance/v1/aitextgen

Endpoints

1. Generate Text

POST /generate

Generate text based on a given prompt.

Request Body

Parameter Type Description
prompt string The input text to start the generation from (required)
max_length integer The maximum length of the generated text (optional, default: 50)
temperature float Controls randomness in generation (optional, 0.0 to 1.0, default: 0.7)
top_p float Nucleus sampling parameter (optional, 0.0 to 1.0, default: 0.9)

Response

{
  "generated_text": "The generated text based on the prompt",
  "tokens_generated": 42,
  "generation_time": 0.8765
}

Example Request

curl -X POST https://api.cryptid.finance/v1/aitextgen/generate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "prompt": "Once upon a time",
  "max_length": 100,
  "temperature": 0.8
}'

2. Fine-tune Model

POST /finetune

Fine-tune the text generation model on custom data.

Request Body

Parameter Type Description
training_data array of strings Array of text samples to fine-tune the model on (required)
epochs integer Number of training epochs (optional, default: 3)
learning_rate float Learning rate for fine-tuning (optional, default: 5e-5)

Response

{
  "status": "success",
  "model_id": "ft_model_12345",
  "training_time": 180.5
}

Rate Limits

The AITextGen API has the following rate limits:

If you exceed these limits, you'll receive a 429 Too Many Requests response.

Error Handling

The API uses standard HTTP response codes to indicate the success or failure of requests.

Code Description
200 OK - Request successful
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Something went wrong on our end

Webhooks

For long-running operations like fine-tuning, you can set up webhooks to receive notifications when the process is complete.

To set up a webhook, use the following endpoint:

POST /webhooks/create

{
  "url": "https://your-app.com/webhook",
  "events": ["finetune.completed", "finetune.failed"]
}

SDKs and Libraries

We provide official SDKs for popular programming languages to make integration easier:

Support

If you need any assistance or have questions, please don't hesitate to contact our support team:

Try AITextGen API