Files
veridian/server/utils/providers/inception.ts
T
zoeissleeping 1d40812f2a refactor: extract provider logic into modular registry
Each AI provider now has its own module implementing a ProviderModule
interface with createGateway, getAuthHeaders, and fetchModels methods.
This replaces the monolithic switch statements in ai-provider.ts and
models.post.ts with a clean registry pattern.
2026-04-27 12:04:49 -05:00

43 lines
1.2 KiB
TypeScript

import { createOpenAI } from '@ai-sdk/openai';
import { GatewayFetchError } from '~~/server/utils/ai-provider';
import { Err, Ok } from '~~/types/result';
import type { ProviderModule } from '.';
export default {
id: 'inception',
baseUrl: 'https://api.inceptionlabs.ai/v1',
modelsEndpoint: null,
createGateway({ apiKey, baseURL }) {
if (apiKey === undefined) {
return Err(GatewayFetchError.NoProviderApiKey);
}
return Ok({
gateway: createOpenAI({ name: 'Inception', apiKey, baseURL }),
streamTransformer: undefined,
textTransformer: undefined,
});
},
getAuthHeaders(apiKey) {
return apiKey ? { Authorization: `Bearer ${apiKey}` } : {};
},
async fetchModels() {
// inception doesn't have a model list endpoint so we hardcode them
return [
{
id: "mercury-2",
name: "Mercury 2",
attributes: {
inputModalities: ['text'],
outputModalities: ['text'],
capabilities: ['tools', 'reasoning'],
contextWindow: 128_000,
}
},
];
},
} satisfies ProviderModule;