Agent Component with OpenRouter
Subgoal: I want the user to be able to switch models easily (hence OpenRouter)
I had this working with Convex without the Agent Component, but I wanted to switch to using the Agent Component.
1. Is there no need for an API key, even for OpenAI integration? I do not see in the docs or video tutorials (like here https://www.youtube.com/watch?v=tUKMPUlOCHY&t=308s) where an API key is used. I imagine it is in an environment variable, but I just did not see it in the docs or video.
2. Is OpenRouter not supported? It looks like the Agent Component expects LanguageModelV1 for
chat and createOpenRouter({apiKey: ...}) gives a type of OpenRouterChatLanguageModel which is apparently v2.Here is the current code in my convex directory and the error on
chatprocess.env.OPENROUTER_BASE_URL is https://openrouter.ai/api/v1Below is the actual type error
Resources
- Agent component ...

