List_models in @google/generative-ai (node.js)

I know there is a list_models method in the generative-ai-python package. It appears that this method is not available in generative-ai-js

Any idea how to return the available models in a node.js based app?

2 Likes

Hi @Ruediger_Seiffert ,

Currently, the genrative-ai-js doesn’t include a function similar to the Python SDK’s list_models() for fetching available models directly. I’ll let you know if this functionality is added in a future update to the new genai-js SDK. Thank you!

Hi Shivam,

I am now doing it like so in Typescript:

const url: string = `https://generativelanguage.googleapis.com/v1beta/models?key=${GOOGLE_API_KEY}`
const response = await axios.get(url)
1 Like