Generate your free API key to start integrating our LLM services into your applications. No registration required, unlimited usage.
Click the button below to generate your free API key instantly.
https://apifreellm.com/api/chat
Send messages and receive AI responses for conversational interactions.
Authorization: Bearer YOUR_API_KEY
application/json
async function sendMessage(apiKey, message) { try { const response = await fetch('https://apifreellm.com/api/chat', { method: 'POST', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ message: message }) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); console.log('AI Response:', data.response); return data; } catch (error) { console.error('Error:', error); throw error; } } // Usage example sendMessage('YOUR_API_KEY', 'Hello, AI!');
import requests import json def send_message(api_key, message): """ Send a message to the ApiFreeLLM chat endpoint """ url = "https://apifreellm.com/api/chat" headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } data = { "message": message } try: response = requests.post(url, headers=headers, json=data) response.raise_for_status() # Raises an HTTPError for bad responses result = response.json() print(f"AI Response: {result['response']}") return result except requests.exceptions.RequestException as e: print(f"Error: {e}") raise # Usage example if __name__ == "__main__": api_key = "YOUR_API_KEY" send_message(api_key, "Hello, AI!")
$headers = @{ "Authorization" = "Bearer YOUR_API_KEY" "Content-Type" = "application/json" } $body = @{ message = "Hello, AI!" } | ConvertTo-Json Invoke-RestMethod -Uri "https://apifreellm.com/api/chat" -Method POST -Headers $headers -Body $body