Llm

API Endpoint

    POST : https://aihub.dev/api/v1/{your-key}/chat
            

LLM Chat API enables you to have conversations about any topic. It's the perfect solution for startups and companies looking to implement new AI-based features.


# Here is a curl example
curl --location --globoff \
'https://aihub.dev/api/v1/{your-api-key}/chat' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "model":"gpt-4o-mini",
    "content":"hi!",
    "role": "user"
}'
                


Result fields:

{
    "status": "string",
    "data": {
        "model": "string",
        "role": "string",
        "message": "string",
        "cost": "integer"
    }
}
                

PARAMETERS

Field Type Required Description
model string Yes Ai model name
content string Yes Content you wan't send to llm model
role string Yes Role

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.

Text To Speech

API Endpoint

    POST : https://aihub.dev/api/v1/{your-key}/textToSpeech 
            

A Text-to-Speech (TTS) model API converts written text into natural-sounding speech, enabling seamless audio content generation. It supports customizable voices, languages, and tones for various applications like accessibility, virtual assistants, and media creation.


# Here is a curl example
curl --location --globoff \
'https://aihub.dev/api/v1/{your-api-key}/textToSpeech' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "model":"tts-1",
    "text":"Hi this is a test text!",
    "voice":"alloy"
}'

                


Result fields:

{
    "status": "string",
    "data": {
        "model": "string",
        "audio": "string",
        "cost": "integer"
    }
}
                

PARAMETERS

Field Type Required Description
model string Yes
text string Yes
voice string Yes

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.

Speech To Text

API Endpoint

    POST : https://aihub.dev/api/v1/{your-key}/speechToText 
            

Speech-to-Text API allows you to convert spoken language into text with high accuracy. It's an ideal solution for startups and companies looking to integrate voice recognition features into their applications.


# Here is a curl example
curl --location --globoff \
'https://aihub.dev/api/v1/{your-api-key}/speechToText' \
--header 'Accept: application/json' \
--form 'file=@"/path/to/file"' \
--form 'model="whisper-large-v3-turbo"' \
--form 'language="en"'
                


Result fields:

{
    "status": "string",
    "data": {
        "model": "string",
        "text": "string",
        "cost": "integer"
    }
}
                

PARAMETERS

Field Type Required Description
model string Yes
file file Yes
language string Yes

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.

Ocr

API Endpoint

    POST : https://aihub.dev/api/v1/{your-key}/ocr
            

AIHub's OCR API enables seamless text extraction from images and scanned documents, converting printed or handwritten text into machine-readable format. Ideal for automating data entry, document digitization, and AI-driven text analysis, our OCR API ensures high accuracy and efficiency for various business applications.


# Here is a curl example
curl --location --globoff \
'https://aihub.dev/api/v1/{your-api-key}/ocr' \
--header 'Accept: application/json' \
--form 'file=@"/path/to/file"' \
--form 'model="whisper-large-v3-turbo"' \
--form 'language="eng"'
                


Result fields:

{
    "status": "string",
    "data": {
        "model": "string",
        "text": "string",
        "cost": "integer"
    }
}
                

PARAMETERS

Field Type Required Description
model string Yes
file file Yes
language string No

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.

Text To Image

API Endpoint

    Post : https://aihub.dev/api/v1/{your-key}/textToImage
            

A text-to-image API generates high-quality images from descriptive text inputs using advanced AI models.


# Here is a curl example
curl --location --globoff \
'https://aihub.dev/api/v1/{your-api-key}/textToImage' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
    "model":"dall-e-3",
    "prompt":"A red car"
}'
                


Result fields:

{
    "status": "string",
    "data": {
        "model": "string",
        "image": "string",
        "cost": "integer"
    }
}
                

PARAMETERS

Field Type Required Description
model string Yes
prompt string Yes
size string No
quality string No
n integer No

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.

Ai models list

API Endpoint

    GET : https://aihub.dev/api/v1/{your-key}/aiModels
            

This give list of ai models that on aihub you can use.


# Here is a curl example
curl --location \
'https://aihub.dev/api/v1/3fa8ad23-1145-4434-a05a-309cda4c317c/aiModels' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data ''
                


Result fields:

{
    "message": "Success",
    "data": {
        "ai_models": [
            {
                "id": 4,
                "name": "dall-e-3",
                "description": null,
                "status": 1,
                "created_at": null,
                "updated_at": null,
                "pricing_details": "{\"hd\": {\"1024x1024\": 0.08, \"1024x1792\": 0.12, \"1792x1024\": 0.12}, \"standard\": {\"1024x1024\": 0.04, \"1024x1792\": 0.08, \"1792x1024\": 0.08}}",
                "type": "image",
                "base_price": null,
                "api_id": 6,
                "minimum_price": "0.04 / image"
            }
        ]
    }
}
                

PARAMETERS

Field Type Required Description
type string No Models type, for example; image ...

Errors

The AiHub API uses the following error codes:

Error Code Meaning
200 The request is OK.
400 Bad Request.
401 Payment Required.