LibreApis.com

API Usage

Chat API:
POST https://libreapis.com/api/gpt4_post.php
Content-Type: application/json

{
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello, give me an example reply."}
  ],
  "seed": 101
}
            
PHP Example for POST:
Download example.txt
            
Chat API (GET):
GET https://libreapis.com/api/gpt4_get.php
Parameters:
- message: User message (required)

Example:
https://libreapis.com/api/gpt4_get.php?message=Hello+give+me+an+example+reply.
            
Image Generation API:
GET or POST https://libreapis.com/api/image.php
Parameters:
- prompt: Image prompt (required, must be in English)
- width: Width (default: 512)
- height: Height (default: 512)
- steps: Quality, min: 20, max: 45 (default: 20)

Example:
https://libreapis.com/api/image.php?prompt=a+robot+image
            
Example cURL:
curl -X POST https://libreapis.com/api/gpt4_post.php \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Hello"}]}'

curl "https://libreapis.com/api/gpt4_get.php?message=Hello+give+me+an+example+reply."

curl "https://libreapis.com/api/image.php?prompt=a+robot+image"

curl "https://libreapis.com/api/image.php?prompt=a+robot+image&width=512&height=512&steps=40"

curl -X POST https://libreapis.com/api/image.php \
  -H "Content-Type: application/json" \
  -d '{"prompt":"a robot image","width":512,"height":512,"steps":40}'