import { createOpenRouter } from "@openrouter/ai-sdk-provider";

/** Singleton OpenRouter client. Uses OPENROUTER_API_KEY from env. */
export const openrouter = createOpenRouter();

/** Stage 1 annotators — cheap reasoning models, low effort. */
export const STAGE1_MODELS = [
  "google/gemini-3.1-flash-lite-preview",
  "xiaomi/mimo-v2-flash",
  "x-ai/grok-4.1-fast",
] as const;

/** Stage 2 judge — medium reasoning. */
export const STAGE2_JUDGE = "anthropic/claude-sonnet-4.6" as const;

/** Full benchmark panel — 9 models from 8 providers. */
export const BENCHMARK_MODELS = [
  ...STAGE1_MODELS,
  "openai/gpt-5.4",
  "moonshotai/kimi-k2.5",
  "google/gemini-3.1-pro-preview",
  "z-ai/glm-5:exacto",
  "minimax/minimax-m2.7:exacto",
  "xiaomi/mimo-v2-pro:exacto",
] as const;

export type Stage1Model = (typeof STAGE1_MODELS)[number];
export type BenchmarkModel = (typeof BENCHMARK_MODELS)[number];

/** Extract the provider name from an OpenRouter model ID. */
export function providerOf(modelId: string): string {
  return modelId.split("/")[0] ?? "unknown";
}
