feat(ai): Fetch Anthropic, Google, and OpenAI models from models.dev instead of OpenRouter

- Updated generate-models.ts to fetch these providers directly from models.dev API
- OpenRouter now only used for xAI and other third-party providers
- Fixed test model IDs to match new model names from models.dev
- Removed unused import from google.ts
This commit is contained in:
Mario Zechner 2025-09-02 01:18:59 +02:00
parent f1c3d44602
commit efaa5cdb39
8 changed files with 772 additions and 910 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,6 @@ import {
type GenerateContentParameters,
GoogleGenAI,
type Part,
setDefaultBaseUrls,
} from "@google/genai";
import { calculateCost } from "../models.js";
import type {

View file

@ -93,12 +93,32 @@ export class OpenAIResponsesLLM implements LLM<OpenAIResponsesLLMOptions> {
}
// Add reasoning options for models that support it
if (this.modelInfo?.reasoning && (options?.reasoningEffort || options?.reasoningSummary)) {
params.reasoning = {
effort: options?.reasoningEffort || "medium",
summary: options?.reasoningSummary || "auto",
};
params.include = ["reasoning.encrypted_content"];
if (this.modelInfo?.reasoning) {
if (options?.reasoningEffort || options?.reasoningSummary) {
params.reasoning = {
effort: options?.reasoningEffort || "medium",
summary: options?.reasoningSummary || "auto",
};
params.include = ["reasoning.encrypted_content"];
} else {
params.reasoning = {
effort: this.modelInfo.name.startsWith("gpt-5") ? "minimal" : null,
summary: null,
};
if (this.modelInfo.name.startsWith("gpt-5")) {
// Jesus Christ, see https://community.openai.com/t/need-reasoning-false-option-for-gpt-5/1351588/7
input.push({
role: "developer",
content: [
{
type: "input_text",
text: "# Juice: 0 !important",
},
],
});
}
}
}
const stream = await this.client.responses.create(params, {