# OpenAi

We support the following endpoints:

```java
public interface OpenAIApi {

  @POST("/v1/completions")
  ListenableFuture<CompletionResult> createCompletion(@Body CompletionRequest request);

  @POST("/v1/chat/completions")
  ListenableFuture<ChatCompletionResult> createChatCompletion(@Body ChatCompletionRequest request);

  @POST("/v1/edits")
  ListenableFuture<EditResult> createEdit(@Body EditRequest request);

  @POST("/v1/embeddings")
  ListenableFuture<EmbeddingResult> createEmbeddings(@Body EmbeddingRequest request);

  @POST("/v1/images/generations")
  ListenableFuture<ImageResult> createImage(@Body CreateImageRequest request);

  @POST("/v1/images/edits")
  ListenableFuture<ImageResult> createImageEdit(@Body RequestBody requestBody);

  @POST("/v1/images/variations")
  ListenableFuture<ImageResult> createImageVariation(@Body RequestBody requestBody);

  @POST("/v1/moderations")
  ListenableFuture<ModerationResult> createModeration(@Body ModerationRequest request);
} 
```

We also support proxy requests and token usage statistics.



### Usage：

As OpenAIServiceConfig is required to initialize OpenAIService, please provide the config instance first.

```java
  @Inject
  public OpenAIService(final OpenAIServiceConfig openAIServiceConfig) {
  ...
  }
```



