[Epic] Enhance Custom Model Support for Multiple Providers (Azure, Gemini, OpenRouter)
🧑💻 Maintainer's Note
A big thanks to @[Original-Poster-Username] for providing the detailed logs!
After analysis, we have confirmed the root cause:
The current "Add Custom Model" feature was designed to support only the "OpenAI" provider type. When a user attempts to configure an Azure OpenAI endpoint, the system does not know how to parse the Azure-specific fields (e.g., Endpoint, API Version, Deployment ID).
This leads directly to the TypeError: Invalid URL ... input: 'undefined/...' error seen in the logs, as the backend logic fails to find the expected configuration values when building the request.
This is not a bug in a specific provider's logic, but rather a core feature (multi-provider support) that is missing.
This issue will now serve as an [Epic] to track the work required to:
- Add a "Provider Type" selector to the UI.
- Implement full (UI + Backend) support for new providers.
🎯 Task Breakdown (Tasks for Contribution)
We have broken this epic into the following independent tasks. Contributions are welcome!
- [ ] Task 1: [Azure] Implement Full Azure OpenAI Support (UI + Backend) (Tracked in #61)
- [ ] Task 2: [Gemini] Implement Full Google Gemini API Support (UI + Backend) (Tracked in #62)
- [ ] Task 3: [OpenRouter] Implement Full Open Router API Support (UI + Backend) (Tracked in #63)
- [ ] Task 4: [Refactor] Refactor "Test Connection" to Support Multiple Provider Types (Tracked in #64)
Original User Report & Logs
When trying to add the api there is a db error Or error on accessing the url
These are the logs
I have removed the api key from logs
--> GET /api/conversation?mode_type=task&agent_id=null 200 6ms 35b
config { channel: 'provider', service: 'Azure', model: 'DeepSeek-V3.1' }
options: {
model_info: {
model_name: 'DeepSeek-V3.1',
platform_name: 'Azure',
api_key: '',
api_url: 'https://schou-m6cjy710-francecentral.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview#/chat/completions',
base_url: 'https://schou-m6cjy710-francecentral.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview#',
is_subscribe: false
}
}
azure.options {
messages: [],
model: 'DeepSeek-V3.1',
prompt: '\n' +
' You are a helpful assistant that generates concise, descriptive titles for conversations with Lemon. Your name is Lemon. Lemon is a helpful AI agent that can interact with a computer to solve tasks using bash terminal, file editor, and browser. Given a user message (which may be truncated), generate a concise, descriptive title for the conversation. Return only the title, with no additional text, quotes, or explanations.\n' +
' Reply in the language used in the message\n' +
' Generate a title for a conversation that starts with this message:\n' +
' \n' +
' hello\n' +
' ',
streaming: true,
temperature: 0
}
config {
"method": "post",
"maxBodyLength": null,
"url": "undefined/openai/responses?api-version=undefined",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer undefined"
},
"data": {
"model": "DeepSeek-V3.1",
"input": [
{
"role": "user",
"content": "\n You are a helpful assistant that generates concise, descriptive titles for conversations with Lemon. Your name is Lemon. Lemon is a helpful AI agent that can interact with a computer to solve tasks using bash terminal, file editor, and browser. Given a user message (which may be truncated), generate a concise, descriptive title for the conversation. Return only the title, with no additional text, quotes, or explanations.\n Reply in the language used in the message\n Generate a title for a conversation that starts with this message:\n \n hello\n "
}
],
"stream": true
}
}
TypeError: Invalid URL
at new URL (node:internal/url:825:25)
at dispatchHttpRequest (/app/node_modules/axios/dist/node/axios.cjs:2925:20)
at /app/node_modules/axios/dist/node/axios.cjs:2845:5
at new Promise (* **Extract the Agent's most core, abstract purpose, removing specific modifiers and qualifiers to make it concise and general.** For example, if the user wants to plan a trip, the name should be "Travel Assistant" instead of "Trip Planning Assistant."\n +
"* The name should accurately reflect the Agent's primary role.\n" +
'\n' +
'When defining "describe":\n' +
"* Explain in as much detail as possible the Agent's main responsibilities, processing flow, expected output, or problems solved.\n" +
"* If the user's request is unclear, make reasonable inferences and additions based on common sense or typical Agent functionalities.\n" +
'\n' +
'Please return the output in JSON format, with fields "name" and "describe".\n' +
'\n' +
'User Request: hello\n' +
' ',
streaming: true
}
config {
"method": "post",
"maxBodyLength": null,
"url": "undefined/openai/responses?api-version=undefined",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer undefined"
},
"data": {
"model": "DeepSeek-V3.1",
"input": [
{
"role": "user",
"content": "You are an expert in defining AI Agent product requirements. Based on the user's request, abstract the core name (name) of the Agent they want to build and a detailed functional description (describe) of that Agent. Return the result in the same language as the user's input.\n\nWhen defining "name":\n* Extract the Agent's most core, abstract purpose, removing specific modifiers and qualifiers to make it concise and general. For example, if the user wants to plan a trip, the name should be "Travel Assistant" instead of "Trip Planning Assistant."\n* The name should accurately reflect the Agent's primary role.\n\nWhen defining "describe":\n* Explain in as much detail as possible the Agent's main responsibilities, processing flow, expected output, or problems solved.\n* If the user's request is unclear, make reasonable inferences and additions based on common sense or typical Agent functionalities.\n\nPlease return the output in JSON format, with fields "name" and "describe".\n\nUser Request: hello\n "
}
],
"stream": true
}
}
TypeError: Invalid URL
at new URL (node:internal/url:825:25)
at dispatchHttpRequest (/app/node_modules/axios/dist/node/axios.cjs:2925:20)
at /app/node_modules/axios/dist/node/axios.cjs:2845:5
at new Promise (
open router provider not work too
Hello, thank you for reporting the DB error and the issues accessing the URL when attempting to add a new API. We appreciate you providing the logs!
Based on the issues you are encountering, please note the current limitation:
Currently, our custom API integration only supports the format consistent with the OpenAI API specifications.
If the API you are trying to add does not adhere to the OpenAI format (e.g., endpoint structure, request/response headers), it will likely lead to parsing issues, which could manifest as the errors you are seeing (including URL access errors or unexpected database entries/failures).
Could you confirm if the API you are trying to integrate follows the OpenAI standard?
We hope to expand support for other API formats in future releases.
Thank you again for your patience and feedback!
sry, but OpenAI not interested as ai provider...