Python and JavaScript
The official OpenAI SDKs work as they are. Change the base URL and the key.
Python
The official OpenAI SDK works as it is. Change the base URL and the key.
Terminal:
pip install openai
Python:
from openai import OpenAI
client = OpenAI(base_url="https://api.thesapientdirective.com/v1", api_key="YOUR_GHOST_KEY")
r = client.chat.completions.create(
model="ghost-x2",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)
JavaScript
Terminal:
npm install openai
JavaScript:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.thesapientdirective.com/v1", apiKey: "YOUR_GHOST_KEY" });
const r = await client.chat.completions.create({
model: "ghost-x2",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);