From d5968a0e94d2d99c62417e89c7c4b0a72c7870d9 Mon Sep 17 00:00:00 2001 From: Thibault Jaigu Date: Thu, 24 Sep 2026 09:29:50 +0200 Subject: [PATCH 1/2] feat: add Requesty provider template Add Requesty (OpenAI compatible router at https://router.requesty.ai/v1) as a built-in provider template next to OpenRouter, list it in the provider docs, and cover the template with a unit test. --- docs/en/guide/providers.md | 2 +- docs/guide/providers.md | 2 +- .../lib/core/models/provider_config.dart | 24 +++++++++++++++++++ spring_note/test/ai_client_service_test.dart | 11 +++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/docs/en/guide/providers.md b/docs/en/guide/providers.md index daea62d..ef0730e 100644 --- a/docs/en/guide/providers.md +++ b/docs/en/guide/providers.md @@ -10,7 +10,7 @@ The search box filters providers by name; the query is case-insensitive. When no ## Add Provider -When adding a provider, you can first select a built-in template. Templates pre-fill the provider name, protocol-corresponding default address, API path, and some example models; these can still be modified before saving. Current templates include OpenAI, OpenAI Responses, DeepSeek, Qwen DashScope, Kimi, OpenRouter, SiliconFlow, Ollama, Google, and Claude. +When adding a provider, you can first select a built-in template. Templates pre-fill the provider name, protocol-corresponding default address, API path, and some example models; these can still be modified before saving. Current templates include OpenAI, OpenAI Responses, DeepSeek, Qwen DashScope, Kimi, OpenRouter, Requesty, SiliconFlow, Ollama, Google, and Claude. The add form includes: diff --git a/docs/guide/providers.md b/docs/guide/providers.md index c3a2ef9..348cd41 100644 --- a/docs/guide/providers.md +++ b/docs/guide/providers.md @@ -10,7 +10,7 @@ ## 添加供应商 -添加供应商时可以先选择内置模板。模板会预填供应商名称、协议对应的默认地址、API 路径和部分示例模型,保存前仍可以修改这些内容。当前模板包括 OpenAI、OpenAI Responses、DeepSeek、Qwen DashScope、Kimi、OpenRouter、SiliconFlow、Ollama、Google 和 Claude。 +添加供应商时可以先选择内置模板。模板会预填供应商名称、协议对应的默认地址、API 路径和部分示例模型,保存前仍可以修改这些内容。当前模板包括 OpenAI、OpenAI Responses、DeepSeek、Qwen DashScope、Kimi、OpenRouter、Requesty、SiliconFlow、Ollama、Google 和 Claude。 添加表单包含: diff --git a/spring_note/lib/core/models/provider_config.dart b/spring_note/lib/core/models/provider_config.dart index 7f1ed91..5422666 100644 --- a/spring_note/lib/core/models/provider_config.dart +++ b/spring_note/lib/core/models/provider_config.dart @@ -28,6 +28,7 @@ class ProviderConfig { 'Qwen DashScope', 'Kimi', 'OpenRouter', + 'Requesty', 'SiliconFlow', 'Ollama', 'Google', @@ -190,6 +191,29 @@ class ProviderConfig { ], ); } + if (normalized == 'requesty') { + return ProviderConfig( + id: _makeId('Requesty'), + enabled: true, + name: 'Requesty', + protocol: 'openaiCompatible', + apiKey: '', + baseUrl: 'https://router.requesty.ai/v1', + apiPath: '/chat/completions', + models: const [ + ModelConfig( + modelId: 'openai/gpt-4.1-mini', + displayName: 'GPT-4.1 Mini', + inputModes: ['text', 'image'], + ), + ModelConfig( + modelId: 'anthropic/claude-sonnet-4-5', + displayName: 'Claude Sonnet 4.5', + inputModes: ['text', 'image'], + ), + ], + ); + } if (normalized == 'siliconflow') { return ProviderConfig( id: _makeId('SiliconFlow'), diff --git a/spring_note/test/ai_client_service_test.dart b/spring_note/test/ai_client_service_test.dart index 7f68105..09148c5 100644 --- a/spring_note/test/ai_client_service_test.dart +++ b/spring_note/test/ai_client_service_test.dart @@ -133,6 +133,17 @@ void main() { expect(deepSeek.models.first.inputModes, isNot(contains('image'))); }); + test('requesty template uses the openai compatible router endpoint', () { + expect(ProviderConfig.templateNames, contains('Requesty')); + + final requesty = ProviderConfig.template('Requesty'); + expect(requesty.name, 'Requesty'); + expect(requesty.protocol, 'openaiCompatible'); + expect(requesty.baseUrl, 'https://router.requesty.ai/v1'); + expect(requesty.apiPath, '/chat/completions'); + expect(requesty.models.first.modelId, 'openai/gpt-4.1-mini'); + }); + test('memory sanitizer preserves complete tool call chains', () { final messages = [ MemoryMessage( From ac0237851313097a4303a0e408d7761a2df7e7e1 Mon Sep 17 00:00:00 2001 From: Thibault Jaigu Date: Fri, 25 Sep 2026 11:17:57 +0100 Subject: [PATCH 2/2] test: cover the full Requesty template --- spring_note/test/ai_client_service_test.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring_note/test/ai_client_service_test.dart b/spring_note/test/ai_client_service_test.dart index 09148c5..477a487 100644 --- a/spring_note/test/ai_client_service_test.dart +++ b/spring_note/test/ai_client_service_test.dart @@ -141,7 +141,12 @@ void main() { expect(requesty.protocol, 'openaiCompatible'); expect(requesty.baseUrl, 'https://router.requesty.ai/v1'); expect(requesty.apiPath, '/chat/completions'); - expect(requesty.models.first.modelId, 'openai/gpt-4.1-mini'); + expect(requesty.enabled, isTrue); + expect(requesty.apiKey, isEmpty); + expect(requesty.models.map((model) => model.modelId), [ + 'openai/gpt-4.1-mini', + 'anthropic/claude-sonnet-4-5', + ]); }); test('memory sanitizer preserves complete tool call chains', () {