Build app just like you use OpenAI (ClosedAI) Official API but it's not GPT models, it's Llama.
Model List:
- meta-llama-3-8b-instruct
- meta--llama-3-70b-instruct
- meta-llama-2-8b-instruct
- meta--llama-2-70b-instruct
- NSTbrowser
- NSTbrowser API Key (Free)
- Node.js
git clone https://github.com/nishantshah977/ChatGPT
- Download NSTbrowser from Affiliate Link.
- Follow upto step 2, Here
- Click on Create Profile, fill up and start
- Copy it and save it to .env file
- Get API Key from API Section
npm run start
Python
import openai
openai.api_key = 'anything'
openai.base_url = "https://localhost:3040/v1/"
completion = openai.chat.completions.create(
model="meta-llama-3-8b-instruct",
messages=[
{"role": "user", "content": "How do I list all files in a directory using Python?"},
],
)
print(completion.choices[0].message.content)
Javascript
import OpenAI from "openai";
const openai = new OpenAI({
apiKey: "anything",
baseURL: "https://localhost:3040/v1",
});
const chatCompletion = await openai.chat.completions.create({
messages: [{ role: "user", content: "Say this is a test" }],
model: "meta-llama-3-8b-instruct",
});
console.log(chatCompletion.choices[0].message.content);
CURL
curl https://localhost:port/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "meta-llama-3-8b-instruct",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Who won the world series in 2020?"
},
{
"role": "assistant",
"content": "The Los Angeles Dodgers won the World Series in 2020."
},
{
"role": "user",
"content": "Where was it played?"
}
]
}'
Thanks To
- https://github.com/PawanOsman/ChatGPT (Chatgpt Request and Response)
- NSTbrowser (Bypass Turnstile)