Simple and free LLM API. Get started in minutes with unlimited usage.
🔑 Get API Key & ExamplesWe believe AI should be accessible to everyone. Our service is completely free - just generate an API key and start building!
Input Text: Up to 200,000 characters (~50,000 tokens)
Output Response: Up to 16,384 tokens (~65,000 characters)
When your input approaches token limits, you'll receive automatic warnings:
https://apifreellm.com/api/chat
{ "message": "Your message here" }
{ "response": "AI generated response" }
Just include our script and start using AI instantly - no backend code or API keys needed for basic usage!
<html> <body> <script src="https://apifreellm.com/apifree.min.js"></script> <script> // Chat with our free AI apifree.chat('What is the meaning of life?').then(apifree.print); </script> </body> </html>
<html> <body> <input type="text" id="userInput" placeholder="Ask anything..."> <button onclick="sendMessage()">Send</button> <script src="https://apifreellm.com/apifree.min.js"></script> <script> async function sendMessage() { const input = document.getElementById('userInput'); const message = input.value; if (!message) return; input.value = 'Thinking...'; try { const response = await apifree.chat(message); apifree.print(response); input.value = ''; } catch (error) { console.error('Error:', error); input.value = 'Error occurred'; } } </script> </body> </html>
<html> <body> <script src="https://apifreellm.com/apifree.min.js"></script> <script> // Stream response word by word apifree.streamChat( 'Tell me a short story about AI', (chunk) => apifree.print(chunk) ); </script> </body> </html>
<html> <body> <script src="https://apifreellm.com/apifree.min.js"></script> <script> (async () => { // Multiple requests const questions = [ 'What is JavaScript?', 'How does AI work?', 'Tell me a fun fact' ]; for (const question of questions) { console.log('Q:', question); const answer = await apifree.chat(question); console.log('A:', answer); console.log('---'); } })(); </script> </body> </html>
✨ No Setup Required: Just include the script and start using AI instantly. Perfect for prototypes, demos, and simple applications!
For backend applications, use our REST API with any programming language:
curl -X POST https://apifreellm.com/api/chat \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "message": "Hello, how are you?", "model": "default" }'
const response = await fetch('https://apifreellm.com/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify({ message: 'What is artificial intelligence?', model: 'default' }) }); const data = await response.json(); console.log(data.response);
import requests url = "https://apifreellm.com/api/chat" headers = { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" } data = { "message": "Explain quantum computing", "model": "default" } response = requests.post(url, headers=headers, json=data) result = response.json() print(result["response"])
<?php $url = 'https://apifreellm.com/api/chat'; $data = json_encode([ 'message' => 'What is the future of AI?', 'model' => 'default' ]); $context = stream_context_create([ 'http' => [ 'method' => 'POST', 'header' => [ 'Content-Type: application/json', 'Authorization: Bearer YOUR_API_KEY' ], 'content' => $data ] ]); $response = file_get_contents($url, false, $context); $result = json_decode($response, true); echo $result['response']; ?>
🔑 Need an API Key? Generate your free API key here for REST API access.
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Tip: Generate your free API key using the button above to see complete code examples.
Request completed successfully.
Missing or invalid message parameter.
Invalid or missing API key.
Temporary server issue. Try again in a moment.