@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
33 lines • 1.02 kB
JavaScript
/**
* Replicate Auth Helper
*
* Resolves the Replicate API token + base URL from per-call overrides,
* instance credentials, or env vars. Used by every Replicate-backed
* handler (LLM, video, avatar, music) so the auth chain is centralised.
*
* @module adapters/replicate/auth
*/
const DEFAULT_BASE_URL = "https://api.replicate.com";
/**
* Resolve Replicate auth from override → env vars.
*
* Returns `null` when `REPLICATE_API_TOKEN` is missing AND no override is
* provided. Handlers' `isConfigured()` check `auth !== null`.
*
* @param override - per-call or instance-level credentials slice
*/
export function getReplicateAuth(override) {
const apiToken = (override?.apiToken ??
process.env.REPLICATE_API_TOKEN ??
"").trim();
if (!apiToken) {
return null;
}
return {
apiToken,
baseUrl: (override?.baseUrl ??
process.env.REPLICATE_BASE_URL ??
DEFAULT_BASE_URL).replace(/\/$/, ""),
};
}
//# sourceMappingURL=auth.js.map