Android SDK
Basic Usage
Make AI requests with ProxyKit Android SDK
Basic Usage
Simple Request
import com.proxykit.sdk.ProxyKit
import kotlinx.coroutines.launch
launch {
val response = ProxyKit.openai.chat.completions.create(
model = "gpt-4o",
messages = listOf(
ChatMessage.user("Hello!")
)
)
println(response.choices.first().message.content)
}With Context (SecureProxy)
import com.proxykit.sdk.SecureProxy
val assistant = SecureProxy(model = ChatModel.gpt4o)
// Remembers previous messages
val response1 = assistant.send("What is Kotlin?")
val response2 = assistant.send("Tell me more") // Knows contextJetpack Compose Example
@Composable
fun ChatScreen() {
var response by remember { mutableStateOf("") }
val scope = rememberCoroutineScope()
Button(onClick = {
scope.launch {
response = ProxyKit.openai.chat.completions.create(
model = "gpt-4o",
messages = listOf(ChatMessage.user("Tell me a joke"))
).choices.first().message.content
}
}) {
Text("Get Response")
}
Text(response)
}