mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
feat(ai): add GPT-6 Astra support
This commit is contained in:
parent
92d8e2d17d
commit
17de82d7be
8 changed files with 91 additions and 22 deletions
|
|
@ -354,13 +354,19 @@ const OPENAI_TOOL_SEARCH_MODEL_IDS = new Set([
|
|||
"gpt-5.6-sol",
|
||||
"gpt-5.6-terra",
|
||||
"gpt-5.6-luna",
|
||||
"gpt-6-astra",
|
||||
]);
|
||||
// Public OpenAI documents additional_tools for applications that load tools
|
||||
// outside the normal tool-search flow. Codex currently uses the input item for
|
||||
// its Responses Lite GPT-5.6 models.
|
||||
// https://developers.openai.com/api/docs/guides/tools-tool-search#add-tools-at-a-specific-point-in-the-input
|
||||
const OPENAI_ADDITIONAL_TOOLS_MODEL_IDS = OPENAI_TOOL_SEARCH_MODEL_IDS;
|
||||
const OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS = new Set(["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"]);
|
||||
const OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS = new Set([
|
||||
"gpt-5.6-sol",
|
||||
"gpt-5.6-terra",
|
||||
"gpt-5.6-luna",
|
||||
"gpt-6-astra",
|
||||
]);
|
||||
const OPENAI_LONG_CONTEXT_INPUT_THRESHOLD = 272000;
|
||||
const OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS = new Set([
|
||||
"gpt-5.4",
|
||||
|
|
@ -368,6 +374,7 @@ const OPENAI_SHORT_CONTEXT_CAPPED_MODEL_IDS = new Set([
|
|||
"gpt-5.6-sol",
|
||||
"gpt-5.6-terra",
|
||||
"gpt-5.6-luna",
|
||||
"gpt-6-astra",
|
||||
]);
|
||||
const OPENAI_LONG_CONTEXT_PRICING_MODEL_IDS = new Set([
|
||||
"gpt-5.4",
|
||||
|
|
@ -377,6 +384,7 @@ const OPENAI_LONG_CONTEXT_PRICING_MODEL_IDS = new Set([
|
|||
"gpt-5.6-sol",
|
||||
"gpt-5.6-terra",
|
||||
"gpt-5.6-luna",
|
||||
"gpt-6-astra",
|
||||
]);
|
||||
|
||||
function withOpenAiLongContextPricing(cost: Model<Api>["cost"]): Model<Api>["cost"] {
|
||||
|
|
@ -525,13 +533,14 @@ function supportsOpenAiXhigh(modelId: string): boolean {
|
|||
modelId.includes("gpt-5.3") ||
|
||||
modelId.includes("gpt-5.4") ||
|
||||
modelId.includes("gpt-5.5") ||
|
||||
modelId.includes("gpt-5.6")
|
||||
modelId.includes("gpt-5.6") ||
|
||||
modelId.includes("gpt-6-astra")
|
||||
);
|
||||
}
|
||||
|
||||
function supportsOpenAiMax(model: Model<Api>): boolean {
|
||||
return (
|
||||
model.id.includes("gpt-5.6") &&
|
||||
(model.id.includes("gpt-5.6") || model.id.includes("gpt-6-astra")) &&
|
||||
(model.api === "openai-responses" ||
|
||||
model.api === "azure-openai-responses" ||
|
||||
model.api === "openai-codex-responses" ||
|
||||
|
|
@ -867,6 +876,22 @@ function applyThinkingLevelMetadata(model: Model<any>): void {
|
|||
) {
|
||||
mergeThinkingLevelMap(model, { off: null });
|
||||
}
|
||||
if (
|
||||
model.id === "gpt-6-astra" &&
|
||||
(model.api === "openai-responses" ||
|
||||
model.api === "azure-openai-responses" ||
|
||||
model.api === "openai-codex-responses")
|
||||
) {
|
||||
mergeThinkingLevelMap(model, {
|
||||
off: null,
|
||||
minimal: null,
|
||||
low: "low",
|
||||
medium: "medium",
|
||||
high: "high",
|
||||
xhigh: "xhigh",
|
||||
max: "max",
|
||||
});
|
||||
}
|
||||
if (model.provider === "github-copilot" && model.id.startsWith("gpt-5")) {
|
||||
mergeThinkingLevelMap(model, { minimal: "low" });
|
||||
}
|
||||
|
|
@ -2488,6 +2513,18 @@ async function generateModels() {
|
|||
|
||||
// Add missing gpt models
|
||||
const missingOpenAiModels: Model<"openai-responses">[] = [
|
||||
{
|
||||
id: "gpt-6-astra",
|
||||
name: "GPT-6 Astra",
|
||||
api: "openai-responses",
|
||||
baseUrl: "https://api.openai.com/v1",
|
||||
provider: "openai",
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: withOpenAiLongContextPricing({ input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 }),
|
||||
contextWindow: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
|
||||
maxTokens: 128000,
|
||||
},
|
||||
{
|
||||
id: "gpt-5.6-sol",
|
||||
name: "GPT-5.6 Sol",
|
||||
|
|
@ -2693,13 +2730,25 @@ async function generateModels() {
|
|||
|
||||
// OpenAI Codex (ChatGPT OAuth) models
|
||||
// NOTE: These are not fetched from models.dev; we keep a small, explicit list to avoid aliases.
|
||||
// Older model limits are based on observed server behavior; GPT-5.6 follows Codex's 272k catalog limit (formerly 372k).
|
||||
// Older model limits are based on observed server behavior; GPT-5.6 and GPT-6 Astra use Codex's 272k default catalog limit.
|
||||
const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
||||
const CODEX_CONTEXT = 272000;
|
||||
const CODEX_GPT_56_CONTEXT = 272000;
|
||||
const CODEX_SPARK_CONTEXT = 128000;
|
||||
const CODEX_MAX_TOKENS = 128000;
|
||||
const codexModels: Model<"openai-codex-responses">[] = [
|
||||
{
|
||||
id: "gpt-6-astra",
|
||||
name: "GPT-6 Astra",
|
||||
api: "openai-codex-responses",
|
||||
provider: "openai-codex",
|
||||
baseUrl: CODEX_BASE_URL,
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: withOpenAiLongContextPricing({ input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 }),
|
||||
contextWindow: CODEX_CONTEXT,
|
||||
maxTokens: CODEX_MAX_TOKENS,
|
||||
},
|
||||
{
|
||||
id: "gpt-5.3-codex-spark",
|
||||
name: "GPT-5.3 Codex Spark",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue