The fal-client packages provide Kotlin and Java interfaces for calling fal AI models on Android and JVM platforms.
Installation
Gradle (Kotlin)
Gradle (Java)
Maven (Kotlin)
Maven (Java)
implementation 'ai.fal.client:fal-client-kotlin:0.7.1'
implementation 'ai.fal.client:fal-client:0.7.1'
< dependency >
< groupId > ai.fal.client </ groupId >
< artifactId > fal-client-kotlin </ artifactId >
< version > 0.7.1 </ version >
</ dependency >
< dependency >
< groupId > ai.fal.client </ groupId >
< artifactId > fal-client </ artifactId >
< version > 0.7.1 </ version >
</ dependency >
Java Async Support If your code relies on asynchronous operations via CompletableFuture or Future, use the ai.fal.client:fal-client-async artifact instead.
Quick Start
import ai.fal.client.kt
val fal = createFalClient ()
val input = mapOf < String , Any >(
"prompt" to "a cat" ,
"seed" to 6252023 ,
"image_size" to "landscape_4_3" ,
"num_images" to 4
)
val result = fal. subscribe ( "fal-ai/flux/dev" , input, options = SubscribeOptions (
logs = true
)) { update ->
if (update is QueueStatus.InProgress) {
println (update.logs)
}
}
import ai.fal.client. * ;
import ai.fal.client.queue. * ;
var fal = FalClient . withEnvCredentials ();
var input = Map . of (
"prompt" , "a cat" ,
"seed" , 6252023 ,
"image_size" , "landscape_4_3" ,
"num_images" , 4
);
var result = fal . subscribe ( "fal-ai/flux/dev" ,
SubscribeOptions. < JsonObject > builder ()
. input (input)
. logs ( true )
. resultType ( JsonObject . class )
. onQueueUpdate (update -> {
if (update instanceof QueueStatus . InProgress ) {
System . out . println ((( QueueStatus . InProgress ) update). getLogs ());
}
})
. build ()
);
Android (API 21+)
JVM (Java 11+)
Kotlin Multiplatform (JVM target)
API Reference
Java API Reference JavaDoc documentation
Kotlin API Reference KDoc documentation
GitHub Repository Source code and examples