-
Notifications
You must be signed in to change notification settings - Fork 167
feat: FalAI integration #190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Implement FalAiBubble with 4 operations (text_to_image, image_to_image, get_status, get_result) - Add async polling with exponential backoff for long-running jobs - Configure credential management (FAL_AI_API_KEY) in backend and frontend - Add logo integration and UI configuration - Include 28 unit tests covering all operations and error cases - Add type safety with Zod schemas and TypeScript types Closes bubblelabai#175
Suggested PR title from PearlTitle: Body: The
Key changes include:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive fal.ai integration to BubbleLab, enabling users to generate and transform images using fal.ai's media generation APIs. The integration implements four operations (text-to-image, image-to-image, status checking, and result retrieval) with full async polling support, proper error handling, and complete UI integration including logo assets and credential management.
Key Changes
- Implemented FalAiBubble service with text-to-image, image-to-image, status checking, and result retrieval operations
- Added async polling with exponential backoff for long-running image generation tasks
- Integrated fal.ai credentials into the credential management system with validation support
- Added UI components including logo, credential cards, and service branding
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bubble-core/src/bubbles/service-bubble/fal-ai.ts | Main bubble implementation with 4 operations, polling logic, and error handling |
| packages/bubble-core/src/bubbles/service-bubble/fal-ai.test.ts | Comprehensive test suite with 28 tests covering all operations and edge cases |
| packages/bubble-core/src/bubble-factory.ts | Registered fal-ai bubble in factory and exports |
| packages/bubble-core/src/index.ts | Exported FalAiBubble class and type definitions |
| packages/bubble-shared-schemas/src/types.ts | Added FAL_AI_API_KEY credential type and fal-ai bubble name |
| packages/bubble-shared-schemas/src/credential-schema.ts | Added credential mappings and bubble credential options |
| packages/bubble-shared-schemas/src/bubble-definition-schema.ts | Added credential configuration |
| apps/bubblelab-api/src/services/credential-validator.ts | Added validation parameters for fal.ai credentials |
| apps/bubble-studio/src/pages/CredentialsPage.tsx | Added UI configuration for fal.ai credentials |
| apps/bubble-studio/src/lib/integrations.ts | Added logo mappings and regex patterns |
| apps/bubble-studio/public/integrations/fal-ai.png | Added fal.ai logo asset |
| 'Current status of the request (IN_QUEUE, IN_PROGRESS, COMPLETED, FAILED)' | ||
| ), | ||
| success: z.boolean().describe('Whether the status check was successful'), | ||
| error: z.string().describe('Error message if the status check failed'), |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error field description says "Error message if the status check failed", but since the field is required (not optional), it would be clearer to describe it as "Error message (empty string if successful)".
| error: z.string().describe('Error message if the status check failed'), | |
| error: z.string().describe('Error message (empty string if successful)'), |
| success: z | ||
| .boolean() | ||
| .describe('Whether the result retrieval was successful'), | ||
| error: z.string().describe('Error message if the result retrieval failed'), |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error field description says "Error message if the result retrieval failed", but since the field is required (not optional), it would be clearer to describe it as "Error message (empty string if successful)".
| error: z.string().describe('Error message if the result retrieval failed'), | |
| error: z.string().describe('Error message (empty string if successful)'), |
| static readonly schema = FalAiParamsSchema; | ||
| static readonly resultSchema = FalAiResultSchema; | ||
| static readonly shortDescription = | ||
| 'Fal AI integration for media generation (text-to-image, image-to-image)'; |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shortDescription uses "Fal AI" but the service name is "fal.ai" (with a dot and lowercase). For consistency with the official service name and the API URL, consider using "fal.ai" instead.
| 'Fal AI integration for media generation (text-to-image, image-to-image)'; | |
| 'fal.ai integration for media generation (text-to-image, image-to-image)'; |
| static readonly shortDescription = | ||
| 'Fal AI integration for media generation (text-to-image, image-to-image)'; | ||
| static readonly longDescription = ` | ||
| Integrate with Fal AI's media generation APIs for creating and transforming images. |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The longDescription uses "Fal AI's" but the service name is "fal.ai" (with a dot and lowercase). For consistency with the official service name, consider using "fal.ai's" instead.
| Integrate with Fal AI's media generation APIs for creating and transforming images. | |
| Integrate with fal.ai's media generation APIs for creating and transforming images. |
| .string() | ||
| .min(1, 'Model is required') | ||
| .describe( | ||
| 'Fal AI model ID (e.g., "fal-ai/flux/dev", "fal-ai/stable-diffusion-v1-5")' |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description uses "Fal AI model ID" but the service name is "fal.ai". For consistency, consider using "fal.ai model ID" instead.
| 'Fal AI model ID (e.g., "fal-ai/flux/dev", "fal-ai/stable-diffusion-v1-5")' | |
| 'fal.ai model ID (e.g., "fal-ai/flux/dev", "fal-ai/stable-diffusion-v1-5")' |
| - fal-ai/flux/dev - Fast, high-quality image generation | ||
| - fal-ai/stable-diffusion-v1-5 - Classic Stable Diffusion | ||
| - fal-ai/flux/schnell - Ultra-fast generation | ||
| - And many more (check Fal AI docs for full list) |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The longDescription references "Fal AI docs" but the service name is "fal.ai". For consistency with the official service name, consider using "fal.ai docs" instead.
| - And many more (check Fal AI docs for full list) | |
| - And many more (check fal.ai docs for full list) |
| model: z | ||
| .string() | ||
| .min(1, 'Model is required') | ||
| .describe('Fal AI model ID for image-to-image (e.g., "fal-ai/flux/dev")'), |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description uses "Fal AI model ID" but the service name is "fal.ai". For consistency, consider using "fal.ai model ID" instead.
| .describe('Fal AI model ID for image-to-image (e.g., "fal-ai/flux/dev")'), | |
| .describe('fal.ai model ID for image-to-image (e.g., "fal-ai/flux/dev")'), |
| return { | ||
| operation: 'text_to_image', | ||
| success: false, | ||
| error: 'Fal AI API key is required', |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message uses "Fal AI API key is required" but the tests expect "fal.ai API key is required". The error messages should be consistent with what the tests expect. Consider using "fal.ai API key is required" to match the service's actual name as shown in the API base URL.
| error: 'Fal AI API key is required', | |
| error: 'fal.ai API key is required', |
| operation: 'get_status', | ||
| status: 'FAILED', | ||
| success: false, | ||
| error: 'Fal AI API key is required', |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message uses "Fal AI API key is required" but the tests expect "fal.ai API key is required". The error messages should be consistent with what the tests expect.
| error: 'Fal AI API key is required', | |
| error: 'fal.ai API key is required', |
| 'Status of the request (IN_QUEUE, IN_PROGRESS, COMPLETED, FAILED)' | ||
| ), | ||
| success: z.boolean().describe('Whether the operation was successful'), | ||
| error: z.string().describe('Error message if the operation failed'), |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error field description says "Error message if the operation failed", but since the field is required (not optional), it would be clearer to describe it as "Error message (empty string if successful)".
|
@iRubeel Thank you so much for this, I will take a closer look sometime tommorw and review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iRubeel Thank you so much for this! A few things:
Could you add the model discovery route: https://docs.fal.ai/platform-apis/v1/models
we are pushing changes to allow dynamic context gathering for pearl and this would help tremendously for pearl to find and use these model correctly.
- Should have search operation to find availble models based on query(that can find model ie veo3 to find the google model),
- Should have list opeartion which should contain openapi schema and some basic details (see offocial doc, they support this)
- For each of the operations, could you attach a screenshot of it succesfully running on bubble studio (if you need credit let us know)
- Could you fix the unit test that is failing?
…BubbleLab into feat/fal-ai-integration
|
Thanks for the feedback @zhubzy! Here's the complete status update. Added Model Discovery RouteImplemented all operations from https://docs.fal.ai/platform-apis/v1/models
1. Search Operation
2. Added List Operation Containing Openapi schema and basic details
3. Fixed the initial unit test failure |


Summary
This PR adds comprehensive fal.ai integration to BubbleLab, enabling users to generate and transform images using fal.ai's media generation APIs. The integration includes four operations (text-to-image, image-to-image, status checking, and result retrieval) with full async polling support, error handling, and UI integration.
Related Issues
Closes #175
Type of Change
Checklist
pnpm checkand all tests passScreenshots (if applicable)
FalAI Logo in Integrations Section
Credential Card
Fal AI Bubble
Additional Context
Files Changed:
New files:
packages/bubble-core/src/bubbles/service-bubble/fal-ai.ts- Main implementationpackages/bubble-core/src/bubbles/service-bubble/fal-ai.test.ts- Unit tests (28 tests)apps/bubble-studio/public/integrations/fal-ai.png- Logo fileModified files:
packages/bubble-core/src/bubble-factory.ts- Bubble registrationpackages/bubble-core/src/index.ts- Exportspackages/bubble-shared-schemas/src/types.ts- CredentialType and BubbleNamepackages/bubble-shared-schemas/src/credential-schema.ts- Credential mappingspackages/bubble-shared-schemas/src/bubble-definition-schema.ts- Bubble configapps/bubblelab-api/src/services/credential-validator.ts- Backend validationapps/bubble-studio/src/pages/CredentialsPage.tsx- Frontend UIapps/bubble-studio/src/lib/integrations.ts- Logo configuration