GitHub for testing OpenAI models

you can use github for testing open ai models
5 Replies
Benjamín Vicente 🇨🇱
import OpenAI from "openai";

const token = process.env["GITHUB_TOKEN"];
const endpoint = "https://models.github.ai/inference";
const model = "openai/gpt-4.1-mini";

export async function main() {

const client = new OpenAI({ baseURL: endpoint, apiKey: token });

const response = await client.chat.completions.create({
messages: [
{ role:"system", content: "You are a helpful assistant." },
{ role:"user", content: "What is the capital of France?" }
],
temperature: 1.0,
top_p: 1.0,
model: model
});

console.log(response.choices[0].message.content);
}

main().catch((err) => {
console.error("The sample encountered an error:", err);
});
import OpenAI from "openai";

const token = process.env["GITHUB_TOKEN"];
const endpoint = "https://models.github.ai/inference";
const model = "openai/gpt-4.1-mini";

export async function main() {

const client = new OpenAI({ baseURL: endpoint, apiKey: token });

const response = await client.chat.completions.create({
messages: [
{ role:"system", content: "You are a helpful assistant." },
{ role:"user", content: "What is the capital of France?" }
],
temperature: 1.0,
top_p: 1.0,
model: model
});

console.log(response.choices[0].message.content);
}

main().catch((err) => {
console.error("The sample encountered an error:", err);
});
Omar
Omar4d ago
GitHub Docs
Prototyping with AI models - GitHub Docs
Find and experiment with AI models for free.
Omar
Omar4d ago
GitHub
Build software better, together
GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.
From An unknown user
From An unknown user
From An unknown user
Jakov
Jakov4d ago
I just checked and I don't see any image generation models.
Benjamín Vicente 🇨🇱
if you pay for chatgpt, there is also the option to redeem $5 via the codex cli https://x.com/OpenAI/status/1923548406703849864
OpenAI (@OpenAI)
Plus and Pro users who sign in to Codex CLI with ChatGPT can now redeem $5 and $50 in free API credits, respectively, for the next 30 days.
X

Did you find this page helpful?