function askAI(prompt) {
const url = "http://43.159.131.124:8760/v1/chat/completions";
const options = {
method: "post",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
payload: JSON.stringify({
model: "gemini",
messages: [{ role: "user", content: prompt }]
})
};
const res = UrlFetchApp.fetch(url, options);
const data = JSON.parse(res.getContentText());
return data.choices[0].message.content;
}
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="http://43.159.131.124:8760/v1"
)
resp = client.chat.completions.create(
model="gemini",
messages=[{"role": "user", "content": "Hello!"}]
)
print(resp.choices[0].message.content)
img = client.images.generate(
model="gemini-image",
prompt="A cute cat with sunglasses"
)
print(img.data[0].b64_json[:50])
curl http://43.159.131.124:8760/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini","messages":[{"role":"user","content":"Hello!"}]}'
curl http://43.159.131.124:8760/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gemini-image","prompt":"A sunset over mountains"}'