public class OpenAiClient extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
debug |
static String |
OPENAI_API_KEY |
static String |
OPENAI_API_URL |
| Constructor and Description |
|---|
OpenAiClient() |
| Modifier and Type | Method and Description |
|---|---|
static OpenAiChatResponse |
chat(String prompt) |
static okhttp3.Response |
chatCompletions(Map<String,String> header,
String bodyString) |
static okhttp3.Call |
chatCompletions(Map<String,String> header,
String bodyString,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(Map<String,String> header,
String bodyString,
okhttp3.sse.EventSourceListener listener) |
static OpenAiChatResponse |
chatCompletions(OpenAiChatRequest chatRequestVo) |
static okhttp3.Call |
chatCompletions(OpenAiChatRequest chatRequestVo,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(OpenAiChatRequest chatRequestVo,
okhttp3.sse.EventSourceListener listener) |
static okhttp3.Response |
chatCompletions(String bodyString) |
static okhttp3.Call |
chatCompletions(String bodyString,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(String bodyString,
okhttp3.sse.EventSourceListener listener) |
static OpenAiChatResponse |
chatCompletions(String model,
List<OpenAiChatMessage> messages) |
static okhttp3.Response |
chatCompletions(String uri,
Map<String,String> requestHeaders,
String bodyString) |
static okhttp3.Call |
chatCompletions(String apiPrefixUrl,
Map<String,String> requestHeaders,
String bodyString,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(String apiPrefixUrl,
Map<String,String> requestHeaders,
String bodyString,
okhttp3.sse.EventSourceListener listener) |
static OpenAiChatResponse |
chatCompletions(String model,
OpenAiChatMessage chatMessage) |
static OpenAiChatResponse |
chatCompletions(String apiKey,
OpenAiChatRequest chatRequestVo) |
static okhttp3.Response |
chatCompletions(String apiKey,
String bodyString) |
static OpenAiChatResponse |
chatCompletions(String model,
String systemPrompt,
List<OpenAiChatMessage> messages) |
static OpenAiChatResponse |
chatCompletions(String apiPerfixUrl,
String apiKey,
OpenAiChatRequest chatRequestVo) |
static okhttp3.Call |
chatCompletions(String serverUrl,
String apiKey,
OpenAiChatRequest chatRequestVo,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(String serverUrl,
String apiKey,
OpenAiChatRequest chatRequestVo,
okhttp3.sse.EventSourceListener listener) |
static okhttp3.Response |
chatCompletions(String apiPerfixUrl,
String apiKey,
String bodyString) |
static okhttp3.Call |
chatCompletions(String apiPerfixUrl,
String apiKey,
String bodyString,
okhttp3.Callback callback) |
static okhttp3.sse.EventSource |
chatCompletions(String apiPerfixUrl,
String apiKey,
String bodyString,
okhttp3.sse.EventSourceListener listener) |
static OpenAiChatResponse |
chatCompletions(String apiUrl,
String key,
String model,
List<OpenAiChatMessage> messages) |
static OpenAiChatResponse |
chatCompletions(String apiUrl,
String key,
String model,
OpenAiChatMessage chatMessage) |
static OpenAiChatResponse |
chatWithImage(String prompt,
byte[] bytes,
String suffix) |
static OpenAiChatResponse |
chatWithImage(String apiKey,
String prompt,
byte[] bytes,
String suffix) |
static OpenAiChatResponse |
chatWithImage(String apiKey,
String model,
String prompt,
byte[] bytes,
String suffix) |
static OpenAiChatResponse |
chatWithModel(String model,
String role,
String prompt) |
static OpenAiChatResponse |
chatWithModel(String apiUrl,
String key,
String model,
String role,
String prompt) |
static OpenAiChatResponse |
chatWithRole(String role,
String prompt) |
static float[] |
embeddingArray(String input) |
static float[] |
embeddingArray(String input,
String model) |
static float[] |
embeddingArray(String serverUrl,
String apiKey,
EmbeddingRequestVo reqVo) |
static float[] |
embeddingArray(String apiKey,
String input,
String model) |
static float[] |
embeddingArray(String serverUrl,
String apiKey,
String input,
String model) |
static float[] |
embeddingArrayByLargeModel(String input) |
static EmbeddingResponseVo |
embeddings(EmbeddingRequestVo embeddingRequestVo) |
static okhttp3.Response |
embeddings(String bodyString) |
static EmbeddingResponseVo |
embeddings(String apiKey,
EmbeddingRequestVo reoVo) |
static okhttp3.Response |
embeddings(String apiKey,
String bodyString) |
static EmbeddingResponseVo |
embeddings(String serverUrl,
String apiKey,
EmbeddingRequestVo reoVo) |
static okhttp3.Response |
embeddings(String api_perfix_url,
String apiKey,
String bodyString) |
static OpenAiChatResponse |
generate(String uri,
OpenAiChatRequest chatRequest) |
static okhttp3.Response |
generate(String uri,
String bodyString) |
static CloudflareModelInfo |
models() |
static CloudflareModelInfo |
models(String apiPrefixUrl) |
public static boolean debug
public static final String OPENAI_API_URL
public static final String OPENAI_API_KEY
public static CloudflareModelInfo models()
public static CloudflareModelInfo models(String apiPrefixUrl)
public static okhttp3.Response chatCompletions(String apiKey, String bodyString)
apiKey - bodyString - public static okhttp3.Response chatCompletions(Map<String,String> header, String bodyString)
header - bodyString - public static okhttp3.Response chatCompletions(String bodyString)
bodyString - public static okhttp3.Call chatCompletions(String bodyString, okhttp3.Callback callback)
bodyString - callback - public static okhttp3.sse.EventSource chatCompletions(String bodyString, okhttp3.sse.EventSourceListener listener)
public static okhttp3.Call chatCompletions(Map<String,String> header, String bodyString, okhttp3.Callback callback)
header - bodyString - callback - public static okhttp3.sse.EventSource chatCompletions(Map<String,String> header, String bodyString, okhttp3.sse.EventSourceListener listener)
public static OpenAiChatResponse chatCompletions(String model, OpenAiChatMessage chatMessage)
model - chatMessage - public static OpenAiChatResponse chatCompletions(String model, List<OpenAiChatMessage> messages)
public static OpenAiChatResponse chatCompletions(String model, String systemPrompt, List<OpenAiChatMessage> messages)
public static OpenAiChatResponse chatCompletions(String apiKey, OpenAiChatRequest chatRequestVo)
apiKey - chatRequestVo - public static OpenAiChatResponse chatCompletions(OpenAiChatRequest chatRequestVo)
chatRequestVo - public static okhttp3.Call chatCompletions(OpenAiChatRequest chatRequestVo, okhttp3.Callback callback)
chatRequestVo - callback - public static okhttp3.sse.EventSource chatCompletions(OpenAiChatRequest chatRequestVo, okhttp3.sse.EventSourceListener listener)
public static OpenAiChatResponse chatCompletions(String apiPerfixUrl, String apiKey, OpenAiChatRequest chatRequestVo)
apiPerfixUrl - apiKey - chatRequestVo - public static okhttp3.Response chatCompletions(String apiPerfixUrl, String apiKey, String bodyString)
apiPerfixUrl - apiKey - bodyString - public static okhttp3.Call chatCompletions(String apiPerfixUrl, String apiKey, String bodyString, okhttp3.Callback callback)
apiPerfixUrl - apiKey - bodyString - callback - public static okhttp3.sse.EventSource chatCompletions(String apiPerfixUrl, String apiKey, String bodyString, okhttp3.sse.EventSourceListener listener)
public static okhttp3.Response chatCompletions(String uri, Map<String,String> requestHeaders, String bodyString)
uri - requestHeaders - bodyString - public static OpenAiChatResponse generate(String uri, OpenAiChatRequest chatRequest)
public static okhttp3.Call chatCompletions(String serverUrl, String apiKey, OpenAiChatRequest chatRequestVo, okhttp3.Callback callback)
serverUrl - apiKey - chatRequestVo - callback - public static okhttp3.sse.EventSource chatCompletions(String serverUrl, String apiKey, OpenAiChatRequest chatRequestVo, okhttp3.sse.EventSourceListener listener)
public static okhttp3.Call chatCompletions(String apiPrefixUrl, Map<String,String> requestHeaders, String bodyString, okhttp3.Callback callback)
apiPrefixUrl - requestHeaders - bodyString - callback - public static okhttp3.sse.EventSource chatCompletions(String apiPrefixUrl, Map<String,String> requestHeaders, String bodyString, okhttp3.sse.EventSourceListener listener)
public static OpenAiChatResponse chat(String prompt)
role - prompt - public static OpenAiChatResponse chatWithRole(String role, String prompt)
role - prompt - public static OpenAiChatResponse chatWithModel(String model, String role, String prompt)
model - role - prompt - public static OpenAiChatResponse chatWithModel(String apiUrl, String key, String model, String role, String prompt)
public static OpenAiChatResponse chatCompletions(String apiUrl, String key, String model, OpenAiChatMessage chatMessage)
public static OpenAiChatResponse chatCompletions(String apiUrl, String key, String model, List<OpenAiChatMessage> messages)
public static okhttp3.Response embeddings(String bodyString)
public static okhttp3.Response embeddings(String api_perfix_url, String apiKey, String bodyString)
public static float[] embeddingArray(String input)
public static float[] embeddingArrayByLargeModel(String input)
public static EmbeddingResponseVo embeddings(EmbeddingRequestVo embeddingRequestVo)
public static EmbeddingResponseVo embeddings(String serverUrl, String apiKey, EmbeddingRequestVo reoVo)
public static EmbeddingResponseVo embeddings(String apiKey, EmbeddingRequestVo reoVo)
public static float[] embeddingArray(String serverUrl, String apiKey, String input, String model)
public static float[] embeddingArray(String serverUrl, String apiKey, EmbeddingRequestVo reqVo)
public static OpenAiChatResponse chatWithImage(String prompt, byte[] bytes, String suffix)
public static OpenAiChatResponse chatWithImage(String apiKey, String model, String prompt, byte[] bytes, String suffix)
public static OpenAiChatResponse chatWithImage(String apiKey, String prompt, byte[] bytes, String suffix)
Copyright © 2026. All rights reserved.