Skip to content

Open AI Android SDK, #ChatGPT, #DALL-E, #ChatGPT Plus, #New Bing

Notifications You must be signed in to change notification settings

Yat3s/openai-android

Repository files navigation

OpenAI Android

The project for OpenAI official APIs

  • Text Completion
  • Image Generation(DALL-E)
  • Playground
  • ChatGPT Web API(ChatGPT Plus)
  • New Bing AI API

Usages

implementation 'com.yat3s.openai:openai-android:0.0.4'

Or exclude okhttp if you're using a version < okhttp3: 4.10.0 in your project.

implementation 'com.yat3s.openai:openai-android:0.0.4' {
   exclude group: "com.squareup.okhttp3"
}

Text Completion

val response = TextCompletionBuilder(BuildConfig.OPENAI_API_KEY).build().textCompletion("Your prompt)

Advanced Configurations

val response = TextCompletionBuilder(OPENAI_API_KEY)
    .maxTokens(1000) // 1 - 4000, default 500
    .temperature(0.6f) // 0 - 2f, default 1f
    .model("you model") // default "text-davinci-003"
    .build().textCompletion(text)

Please check the definition on Open AI text completion parameters

Image Generation(DALL-E)

val response = ImageGenerationBuilder(BuildConfig.OPENAI_API_KEY).build().imageGeneration("Your prompt")

Advanced Configurations

val response = ImageGenerationBuilder(OPENAI_API_KEY)
    .generateCount(2) // The image count to generate, default 1
    .imageSize("512x512") // "256x256", "512x512", "1024x1024" are supported, default "1024x1024"
    .imageResponseFormat("url") // "url", "b64_json" are supported, default "url"
    .build()
    .imageGeneration("Your prompt")

How to get API KEY

Please go to Open AI API KEY to create your API keys. image

About

Open AI Android SDK, #ChatGPT, #DALL-E, #ChatGPT Plus, #New Bing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages