Loki.AI API

Powerful AI Integration at Your Fingertips

Made With ❤️ by Parth Sadaria

Scroll Down For More Info
v

Quick Start Guide

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

Supports stream :)

Models Endpoint

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
# 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

More info at https://parthsadaria-lokiai.hf.space/models

o1-preview
o1-mini
gpt-4o
gpt-4o-mini
llama-3.1-405b
llama-3.1-7b
llama-3.1-80b
gemini-1.0-pro-001
gemini-1.5-pro
gemini-pro
gemini-pro-vision
gpt-3.5-turbo
gpt-3.5-turbo-0125
gpt-3.5-turbo-0301
gpt-3.5-turbo-0613
gpt-3.5-turbo-1106
gpt-3.5-turbo-16k
gpt-3.5-turbo-16k-0613
gpt-3.5-turbo-instruct
gpt-35-turbo
gpt-35-turbo-16k
gpt-4
gpt-4-0125-preview
gpt-4-0314
gpt-4-0613
gpt-4-1106-preview
gpt-4-32k
gpt-4-32k-0314
gpt-4-32k-0613
gpt-4-turbo
gpt-4-turbo-2024-04-09
gpt-4-turbo-preview
gpt-4-vision-preview
gpt-4o-2024-05-13
gpt-4o-all
gpt-4o-mini-2024-07-18
hunyuan-lite
hunyuan-pro
hunyuan-standard
hunyuan-standard-256K
mistral-medium
mixtral-8x7b
net-gpt-4-all
o1-mini-2024-09-12
o1-mini-all
o1-preview-2024-09-12
o1-preview-all
qwen-72b
qwen-long
qwen-max
qwen-max-longcontext
qwen-plus
qwen-turbo
360GPT_S2_V9
abab5.5s-chat
abab6-chat
Baichuan2-Turbo
chatglm_lite
chatglm_pro
chatglm_std
chatglm_turbo
code-llama-13b
code-llama-34b
code-llama-7b

Get Started Now

Ready to integrate Loki.AI into your application?

Join Our Discord Community