🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(cloud): add Seedream 5 Lite model (#12459)
YuTengjingf84a363b758b
diff --git a/packages/model-bank/src/aiModels/lobehub/image.ts b/packages/model-bank/src/aiModels/lobehub/image.tsindex aace9314129..df5cf09a54a 100644--- a/packages/model-bank/src/aiModels/lobehub/image.ts+++ b/packages/model-bank/src/aiModels/lobehub/image.ts@@ -156,6 +156,37 @@ export const lobehubImageModels: AIImageModelCard[] = [},type: 'image',},+ {+ description:+ 'ByteDance-Seedream-5.0-lite by BytePlus features web-retrieval-augmented generation for real-time information, enhanced complex prompt interpretation, and improved reference consistency for professional visual creation.',+ displayName: 'Seedream 5 Lite',+ enabled: true,+ id: 'seedream-5-0-260128',+ parameters: {+ imageUrls: { default: [], maxCount: 14, maxFileSize: 10 * 1024 * 1024 },+ prompt: { default: '' },+ seed: { default: null },+ size: {+ default: '2048x2048',+ enum: [+ '2048x2048',+ '2560x1440',+ '1440x2560',+ '3072x2048',+ '2048x3072',+ '2560x2048',+ '2048x2560',+ '3072x1920',+ '1920x3072',+ ],+ },+ },+ pricing: {+ units: [{ name: 'imageGeneration', rate: 0.035, strategy: 'fixed', unit: 'image' }],+ },+ releasedAt: '2026-02-24',+ type: 'image',+ },{description:'Seedream 4.5, built by ByteDance Seed team, supports multi-image editing and composition. Features enhanced subject consistency, precise instruction following, spatial logic understanding, aesthetic expression, poster layout and logo design with high-precision text-image rendering.',diff --git a/packages/model-runtime/src/providers/volcengine/createImage.test.ts b/packages/model-runtime/src/providers/volcengine/createImage.test.tsindex 02c045a34bb..a9db7ce7ef8 100644--- a/packages/model-runtime/src/providers/volcengine/createImage.test.ts+++ b/packages/model-runtime/src/providers/volcengine/createImage.test.ts@@ -189,6 +189,29 @@ describe('createVolcengineImage', () => {});});+ it('should strip height and width when size is provided', async () => {+ const mockResponse = {+ data: [{ url: 'https://example.com/test.jpg' }],+ };+ mockGenerate.mockResolvedValue(mockResponse);++ payload.params = {+ prompt: 'test prompt',+ size: '2048x2048',+ height: 1024,+ width: 1024,+ };++ await createVolcengineImage(payload, options);++ expect(mockGenerate).toHaveBeenCalledWith({+ model: 'doubao-seedream-3-0-t2i',+ watermark: false,+ prompt: 'test prompt',+ size: '2048x2048',+ });+ });+it('should convert height and width to size parameter', async () => {const mockResponse = {data: [{ url: 'https://example.com/test.jpg' }],@@ -355,6 +378,23 @@ describe('createVolcengineImage', () => {});});+ it('should use BytePlus baseURL for international endpoint', async () => {+ const mockResponse = {+ data: [{ url: 'https://example.com/test.jpg' }],+ };+ mockGenerate.mockResolvedValue(mockResponse);++ options.baseURL = 'https://ark.ap-southeast.bytepluses.com/api/v3';++ await createVolcengineImage(payload, options);++ const OpenAI = await import('openai');+ expect(OpenAI.default).toHaveBeenCalledWith({+ apiKey: 'test-api-key',+ baseURL: 'https://ark.ap-southeast.bytepluses.com/api/v3',+ });+ });+it('should use default baseURL when not provided', async () => {const mockResponse = {data: [{ url: 'https://example.com/test.jpg' }],diff --git a/packages/model-runtime/src/providers/volcengine/createImage.ts b/packages/model-runtime/src/providers/volcengine/createImage.tsindex d5147bb1161..3a5386207f7 100644--- a/packages/model-runtime/src/providers/volcengine/createImage.ts+++ b/packages/model-runtime/src/providers/volcengine/createImage.ts@@ -39,14 +39,20 @@ export async function createVolcengineImage(]),);- // Convert height and weight/width to size parameter- const imgHeight = userInput.height;- const imgWidth = userInput.width;-- if (imgHeight !== undefined && imgWidth !== undefined) {- userInput.size = `${imgWidth}x${imgHeight}`;+ // Handle size parameter: use directly if provided, otherwise convert from height/width+ if (userInput.size) {+ log('Using direct size parameter: %s', userInput.size);delete userInput.height;delete userInput.width;+ } else {+ const imgHeight = userInput.height;+ const imgWidth = userInput.width;++ if (imgHeight !== undefined && imgWidth !== undefined) {+ userInput.size = `${imgWidth}x${imgHeight}`;+ delete userInput.height;+ delete userInput.width;+ }}// Volcengine supports direct URL or base64, no need to convert to File objectsdiff --git a/src/business/server/image-generation/chargeAfterGenerate.ts b/src/business/server/image-generation/chargeAfterGenerate.tsindex 8bc1b94c7fd..7affe4d5c54 100644--- a/src/business/server/image-generation/chargeAfterGenerate.ts+++ b/src/business/server/image-generation/chargeAfterGenerate.ts@@ -1,4 +1,4 @@-import { type ModelUsage } from '@/types/index';+import { type ModelPerformance, type ModelUsage } from '@/types/index';interface ChargeParams {metadata: {@@ -7,6 +7,7 @@ interface ChargeParams {modelId: string;topicId?: string;};+ metrics?: ModelPerformance;modelUsage?: ModelUsage;provider: string;userId: string;diff --git a/src/server/routers/async/image.ts b/src/server/routers/async/image.tsindex b0835a396e2..f1baccb544a 100644--- a/src/server/routers/async/image.ts+++ b/src/server/routers/async/image.ts@@ -265,20 +265,6 @@ export const imageRouter = router({const { modelUsage } = response;- if (ENABLE_BUSINESS_FEATURES) {- await chargeAfterGenerate({- metadata: {- asyncTaskId: taskId,- generationBatchId,- modelId: model,- topicId: generationTopicId,- },- modelUsage,- provider,- userId: ctx.userId,- });- }-// Check if operation has been cancelledcheckAbortSignal(signal);@@ -348,11 +334,29 @@ export const imageRouter = router({},);- log('Updating task status to Success: %s', taskId);+ const duration = Date.now() - generationBatch.createdAt.getTime();++ log('Updating task status to Success: %s, duration: %dms', taskId, duration);await ctx.asyncTaskModel.update(taskId, {+ duration,status: AsyncTaskStatus.Success,});+ if (ENABLE_BUSINESS_FEATURES) {+ await chargeAfterGenerate({+ metrics: { latency: duration },+ metadata: {+ asyncTaskId: taskId,+ generationBatchId,+ modelId: model,+ topicId: generationTopicId,+ },+ modelUsage,+ provider,+ userId: ctx.userId,+ });+ }+log('Async image generation completed successfully: %s', taskId);return { success: true };};