@entro314labs/ai-changelog-generator
Version:
AI-powered changelog generator with MCP server support - works with most providers, online and local models
79 lines (78 loc) • 3.23 kB
TypeScript
/**
* Vercel AI Gateway Provider
*
* Routes completions through the Vercel AI Gateway using the Vercel AI SDK
* (`ai` + `@ai-sdk/gateway`) rather than a vendor SDK. One credential reaches
* every model the gateway fronts, addressed as `<provider>/<model>`.
*
* Authentication resolves in the SDK's own order:
* 1. `AI_GATEWAY_API_KEY`
* 2. Vercel OIDC (`VERCEL_OIDC_TOKEN`, or the per-request OIDC header when
* running on Vercel)
*
* BYOK and local providers (OpenAI, Anthropic, Google, Bedrock, Ollama,
* LM Studio, ...) remain available and unchanged; this is an additional route,
* not a replacement for them.
*/
import { BaseProvider } from '../core/base-provider.js';
/**
* Pinned snapshot rather than a floating alias: a changelog is a reproducible
* artifact, and an upstream snapshot rotation would otherwise silently change
* generated output with no code change to point at.
*/
export declare const DEFAULT_GATEWAY_MODEL = "deepseek/deepseek-v4-flash-0731";
declare class VercelGatewayProvider extends BaseProvider {
[key: string]: any;
constructor(config: any);
initializeClient(): void;
getName(): string;
/**
* An API key or an OIDC token is enough. On a Vercel runtime the OIDC token
* usually arrives as a request header and never appears in the environment,
* so treat "running on Vercel" as credentials-may-exist: a false negative
* here disables the provider entirely, which is the worse failure.
*/
isAvailable(): boolean;
getRequiredEnvVars(): string[];
getCapabilities(_modelName?: string): {
streaming: boolean;
tool_use: boolean;
json_mode: boolean;
vision: boolean;
reasoning: boolean;
temperature_control: boolean;
};
/**
* The gateway's catalogue is remote and changes independently of this package,
* so it is queried rather than hard-coded. Returns [] when unreachable: an
* empty catalogue degrades model pickers, a throw would break provider health.
*/
getAvailableModels(): Promise<{
id: any;
name: any;
description: any;
}[]>;
/**
* Resolve a gateway model, wrapped in the response cache unless caching is
* disabled. Wrapping at the model boundary means every call path — commit
* summaries, working-directory analysis, commit messages — shares one cache
* without any of them knowing about it.
*/
resolveModel(modelId: string): any;
resolveTemperature(options: Record<string, any>, modelConfig: Record<string, any>): any;
/** Cache counters for this process, surfaced in provider info/metrics. */
getCacheStats(): {
hits: any;
misses: any;
};
/**
* Translate the internal chat-message contract into an AI SDK call. Any
* leading system messages become `system`, matching how generateText separates
* the system prompt from the conversation.
*/
generateCompletion(messages: any, options?: Record<string, any>): Promise<import("../core/base-provider.js").ProviderResult>;
generateEmbedding(): Promise<void>;
}
declare const _default: any;
export default _default;
export { VercelGatewayProvider };