Free ChatGPT API

Introduction

MiniToolAI Free ChatGPT API allows you to use chatGPT's API for free. Suitable for testing, research, or learning purposes and not for commercial use.

Try our official API: API Docs

Who can use MiniTool Free ChatGPT API?

Your MiniToolAI API key:

sk-*************   Login to generate API key

Create chat completion

POST https://minitoolai.com/api/chatgpt/

Headers "Authorization: Bearer MINITOOLAI-API-KEY"

Body

[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello"}
]

Sample Python code

import requests, json

url = "https://minitoolai.com/api/chatgpt/" #ending in "/"
headers = {
    "Authorization": "Bearer MINITOOLAI-API-KEY",
    "Content-Type": "application/json"
}
data = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello"},
    {"role": "assistant", "content": "How can I help you today?"},
    {"role": "user", "content": "What's the largest U.S. state by area?"}
]

response = requests.post(url, headers=headers, json=data, stream=True)
print(response.text)

Streamed

import json
....
for line in response.iter_lines():
    if line:
        decode_line = line.decode('utf-8')
        if decode_line.startswith('data: {"content"'):
            json_line = json.loads(decode_line[6:])
            if 'content' in json_line:
                content = json_line['content']
                print(content, end="", flush=True)

Single result

import json
....
for line in response.iter_lines():
    if line:
        decode_line = line.decode('utf-8')
        if decode_line.startswith('data: {"content"'):
            json_line = json.loads(decode_line[6:])
            if 'content' in json_line:
                content = json_line['content']
                result += content
print(result)			

Limitation

API might make mistakes, check important info.

Rate limit: 100 000 requests/month for each user.

Currently in beta version, updated weekly.

Tags: Free OpenAI API, free chatgpt api, free gpt api, gpt-4o api free