Loki.AI API
Powerful AI Integration at Your Fingertips For Free
Made With ❤️ by
Parth Sadaria
Scroll Down For More Infov
Report Bugs and Issues on github :) (scroll down for link)
🔥 O1-Preview 🔥
Quick Start Guide
NEW!!!-Playground (Beta) 🥳🥳
https://parthsadaria-lokiai.hf.space/playground
Base URL
https://parthsadaria-lokiai.hf.space
Chat Completion URL
https://parthsadaria-lokiai.hf.space/chat/completions
Searchgpt URL
https://parthsadaria-lokiai.hf.space/searchgpt?q=todays news
Note: Use &stream=true
to enable streaming responses.
Get requests only | Supports stream :) | set &stream=true
Image Generation URL 🥳🥳 (Powered by Pollinations.ai )
https://parthsadaria-lokiai.hf.space/images/generations?prompt=sky%20northern%20lights
Parameters:
prompt: (required) Text description of the image.
model: (optional) Model to use (default: "flux").
seed: (optional) Random seed for reproducibility.
width: (optional) Image width in pixels.
height: (optional) Image height in pixels.
Memes go brrrrrr~
https://parthsadaria-lokiai.hf.space/meme
Global Usage Checker :) (if you are curious)
https://parthsadaria-lokiai.hf.space/usage/page
Models Endpoint
Both Models Image and Chat are mentioned here
https://parthsadaria-lokiai.hf.space/models
Authentication
ITS FREE :) NO NEED FOR ANY AUTH WOHOOOOO!! 🥳
Request Format
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello, AI!"
}
],
"stream": False #specify it
}
Response Format
{{
"id": "chatcmpl-89DmxGJl4oqEultjlLBnGfdkV7Euk",
"model": "gpt-4o",
"object": "chat.completion",
"created": 1731674826,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 11,
"completion_tokens": 9,
"total_tokens": 20
}
}
}
Example Usage
import openai Copy
# hampe to he hi no :p (not needed)
api_key = ''
# Use the custom API endpoint
openai.api_base = "https://parthsadaria-lokiai.hf.space"
openai.api_key = api_key
def chat_with_gpt ():
try :
response = openai.ChatCompletion.create(
model="gpt-4o" ,
messages=[{"role" : "user" , "content" : "hi homie" }],
stream=False
)
print (response['choices' ][0 ]['message' ]['content' ])
except Exception as e:
print (f"Error: {e} " )
chat_with_gpt()
Available Models
Text copied!
More info at https://parthsadaria-lokiai.hf.space/models
gpt-4ostable & fast
gpt-4o-mini stable & fast
claude-3-haikustable & fast
llama-3.1-405bstable & fast
llama-3.1-70bstable & fast
llama-3.1-8bstable & fast
gemini-1.5-flashstable & fast
mixtral-8x7bstable & fast
command-rstable & fast
gemini-prostable & fast
gpt-3.5-turbostable & fast
commandstable & fast