API Endpoints
POST /chat | /askcarti
Tags: Machine Learning
Description
Handles AI chat requests.
Request
Content-Type: application/json
Request Body:
Parameters:
prompt
(string): The input prompt for the AI model.web
(boolean, optional): Optional flag to indicate if web search is enabled. (default:False
)
Response
Content-Type: application/json
Response Body:
Error Responses
401 Unauthorized: Unauthorized access.
400 Bad Request: Missing required
prompt
field.500 Internal Server Error: GPU is offline.
Example Error Response:
Notes
The
Authorization
header must be present with a valid token.If the prompt is missing or if there is an exception during the AI processing, appropriate error messages will be returned.
POST /image2text
Tags: Machine Learning
Description
Converts an image to text.
Request
Content-Type: application/octet-stream
Request Body:
Body: Raw image bytes.
Response
Content-Type: application/json
Response Body:
Error Responses:
400 Bad Request: Image is required.
401 Unauthorized: Content is NSFW.
500 Internal Server Error: Error message detailing the issue.
Example Error Response:
Notes
The request body must contain raw image bytes.
The endpoint checks for NSFW content and will return an error if the content is deemed inappropriate.
The text extracted from the image will be returned in the response.
POST /image/classify
Tags: Machine Learning
Description
Classifies the content of an image.
Request
Content-Type: application/octet-stream
Request Body:
Body: Raw image bytes.
Response
Content-Type: application/json
Response Body:
Error Responses:
400 Bad Request: Image is required.
401 Unauthorized: Content is NSFW.
500 Internal Server Error: Error message detailing the issue.
Example Error Response:
Notes
The request body must contain raw image bytes.
The endpoint checks for NSFW content and will return an error if the content is deemed inappropriate.
The classification result of the image will be returned in the response.
POST /image
Tags: Machine Learning
Description
Handles image generation requests. This endpoint receives a JSON request containing a prompt
, generates an image based on the prompt, adds a watermark, and returns the watermarked image.
Request
Content-Type: application/json
Request Body:
Parameters:
prompt
(string): The input prompt for generating the image.
Response
Success Response:
Content-Type: image/jpeg
The response will be a streaming image file with a JPEG format.
Error Responses:
400 Bad Request: Missing
prompt
field.
Example Error Response:
500 Internal Server Error: Error occurred during image generation.
Example Error Response:
Notes
The
prompt
field is required in the request body. If it is missing, a400 Bad Request
error will be returned.The endpoint processes the prompt to generate an image, applies a watermark, and then returns the image as a streaming response in JPEG format.
If an error occurs during image generation or watermarking, a
500 Internal Server Error
with a detailed error message will be returned.
POST /ocr
Tags: Machine Learning
Description
Extracts text from an image using Optical Character Recognition (OCR). This endpoint receives an image, processes it to extract text, and returns the text as a plain text response.
Request
Content-Type: application/octet-stream
Request Body:
Body: Raw image bytes.
Response
Success Response:
Content-Type: text/plain
The response will contain the extracted text from the image.
Error Responses:
400 Bad Request: Image is required.
Example Error Response:
500 Internal Server Error: Error occurred during OCR processing.
Example Error Response:
Notes
The request body must contain raw image bytes.
If the image is not provided, a
400 Bad Request
error will be returned.The text extracted from the image will be returned as plain text in the response.
In case of any processing errors, a
500 Internal Server Error
with a detailed error message will be returned.
POST /chat/image
Tags: Machine Learning
Description
Chats with an AI using both a text prompt and an image. The endpoint receives a prompt and an image (in base64 format), processes them, and returns the AI's response.
Request
Content-Type: application/json
Request Body:
Parameters:
prompt
(string): The text prompt to send to the AI.image
(string): The image to send to the AI in base64 format.
Response
Content-Type: application/json
Success Response:
Error Responses:
400 Bad Request: Missing
prompt
orimage
.
Example Error Response:
500 Internal Server Error: Error occurred during processing.
Example Error Response:
Notes
Both
prompt
andimage
fields are required in the request body. If either is missing, a400 Bad Request
error will be returned.The
image
should be in base64 encoded format.The AI's response will be returned in the JSON format specified in the success response.
If an error occurs during processing, a
500 Internal Server Error
with a detailed error message will be returned.
Here’s the Markdown documentation for the /screenshot
endpoint, formatted for GitBook:
GET /screenshot
Tags: Scraping
Description
Takes a screenshot of a specified website. This endpoint requires a URL as a query parameter and optionally accepts a delay before capturing the screenshot. It returns the screenshot image if the URL is valid and not blocked. If the content is NSFW, an error response is returned.
Request
Query Parameters:
url
(string): The URL of the website to capture. This should include the scheme (http
orhttps
).delay
(integer, optional): The number of seconds to wait before taking the screenshot.
Example Request:
Response
Success Response:
Content-Type: image/jpeg
Returns a JPEG image of the screenshot.
Error Responses:
400 Bad Request: Invalid URL scheme or URL is malformed.
Example Error Response:
403 Forbidden: URL is blocked by the block list.
Example Error Response:
401 Unauthorized: Content is NSFW.
Example Error Response:
500 Internal Server Error: An error occurred during screenshot capture.
Example Error Response:
Notes
The
url
parameter must include the scheme (http
orhttps
). URLs with other schemes will result in a400 Bad Request
error.The
delay
parameter, if provided, specifies how long to wait before capturing the screenshot. If not provided, the default behavior is to capture the screenshot immediately.URLs in the
blocked_urls
list are not allowed and will return a403 Forbidden
error.If the content of the screenshot is detected as NSFW, a
401 Unauthorized
response will be returned.In case of processing errors, a
500 Internal Server Error
will be returned with details about the issue.
Last updated