完全免费的AI GPT-Loki.AI API
介绍
Loki.AI API 是一个在线集成工具,可以在您的应用程序中完全免费使用 GPT-4o、4o-mini 等型号
官网:https://parthsadaria-lokiai.hf.space
Playground (网页聊天) 🥳🥳
https://parthsadaria-lokiai.hf.space/playground
Base URL
https://parthsadaria-lokiai.hf.space
图像生成URL 🥳🥳
https://parthsadaria-lokiai.hf.space/images/generations?prompt=sky%20northern%20lights
聊天完成 URL
https://parthsadaria-lokiai.hf.space/chat/completions
搜索 gpt URL
https://parthsadaria-lokiai.hf.space/searchgpt?q=todays news
Note: Use &stream=true
to enable streaming responses.
仅获取请求 支持流:) |设置 &stream=true
使用情况检查器
https://parthsadaria-lokiai.hf.space/usage/page
Models 端点
https://parthsadaria-lokiai.hf.space/models
请求格式
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello, AI!"
}
],
"stream": false
}
📤 响应格式
{
"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
}
}
🛠️ 示例用法
import openai
# Set API details
api_key = '' # No key needed!
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()
🎨 可用型号
GPT 系列
- •
gpt-4o
- •
gpt-4o-mini
- •
gpt-3.5-turbo
Llama 家族
- •
llama-3.1-7b
- •
llama-3.1-405b
- •
llama-3.1-80b
双子座模型
- •
gemini-pro
- •
gemini-1.5-flash
Mistral 模型
- •
mistral-medium
- •
mixtral-8x7b
📚 有关模型的完整列表,请访问:[模型文档]https://parthsadaria-lokiai.hf.space/models
js中调用示例
你可以在我的主页双击头像进入终端中查看