import { OpenAiCompatibleAdapter } from './openai-compatible-adapter.js';
import { OpenAiCompatibleModelName } from './openai-compatible-model.js';
import { OpenAiCompatibleProviderProfileService } from './openai-compatible-profiles.js';
/**
 * Registers one OpenAI-compatible profile with the built-in LLM registry.
 * Each instance owns one provider prefix and delegates shared transport to
 * `OpenAiCompatibleAdapter`.
 */
export class OpenAiCompatibleProviderAdapter {
    profile;
    provider;
    constructor(profile) {
        this.profile = profile;
        this.provider = profile.id;
    }
    inferModel(model) {
        return OpenAiCompatibleProviderProfileService.findByModel(model)?.id === this.provider;
    }
    defaultModel() {
        const model = process.env[this.profile.defaultModelEnvName]?.trim();
        if (!model) {
            throw new Error(`${this.profile.label} model is required. Set ${this.profile.defaultModelEnvName} or select a model with the ${this.profile.modelPrefix}/<model> prefix.`);
        }
        return OpenAiCompatibleModelName.toHeddleModel(this.profile, model);
    }
    createAdapter(input) {
        return new OpenAiCompatibleAdapter({
            ...input,
            profile: this.profile,
        });
    }
}
//# sourceMappingURL=openai-compatible-provider-adapter.js.map