Creates a Moonshot AI provider for OpenAI-compatible completions.
// Source: https://github.com/badlogic/pi-mono | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
import { openAICompletionsApi } from "../api/openai-completions.lazy.ts";
import { envApiKeyAuth } from "../auth/helpers.ts";
import { createProvider, type Provider } from "../models.ts";
import { MOONSHOTAI_MODELS } from "./moonshotai.models.ts";
export function moonshotaiProvider(): Provider<"openai-completions"> {
return createProvider({
id: "moonshotai",
name: "Moonshot AI",
baseUrl: "https://api.moonshot.ai/v1",
auth: { apiKey: envApiKeyAuth("Moonshot AI API key", ["MOONSHOT_API_KEY"]) },
models: Object.values(MOONSHOTAI_MODELS),
api: openAICompletionsApi(),
});
}
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key