|
1 | 1 | package com.plexpt.chatgpt.api; |
2 | 2 |
|
3 | 3 | import com.plexpt.chatgpt.entity.audio.AudioResponse; |
| 4 | +import com.plexpt.chatgpt.entity.audio.SpeechRequest; |
4 | 5 | import com.plexpt.chatgpt.entity.audio.Transcriptions; |
5 | 6 | import com.plexpt.chatgpt.entity.billing.CreditGrantsResponse; |
6 | 7 | import com.plexpt.chatgpt.entity.billing.SubscriptionData; |
|
17 | 18 | import okhttp3.MultipartBody; |
18 | 19 | import retrofit2.http.*; |
19 | 20 |
|
20 | | - |
21 | 21 | /** |
22 | | - * |
| 22 | + * API接口 |
| 23 | + * API interface |
23 | 24 | */ |
24 | 25 | public interface Api { |
25 | 26 |
|
26 | 27 | String DEFAULT_API_HOST = "https://api.openai.com/"; |
27 | 28 |
|
28 | | - |
29 | 29 | /** |
30 | | - * chat |
| 30 | + * 聊天 |
| 31 | + * Chat |
31 | 32 | */ |
32 | 33 | @POST("v1/chat/completions") |
33 | 34 | Single<ChatCompletionResponse> chatCompletion(@Body ChatCompletion chatCompletion); |
34 | 35 |
|
35 | 36 | /** |
36 | | - * image_generations |
| 37 | + * 图像生成 |
| 38 | + * Image generations |
37 | 39 | */ |
38 | 40 | @POST("v1/images/generations") |
39 | 41 | Single<ImagesRensponse> imageGenerations(@Body Generations generations); |
40 | 42 |
|
41 | 43 | /** |
42 | | - * image_edits |
| 44 | + * 图像编辑 |
| 45 | + * Image edits |
43 | 46 | */ |
44 | 47 | @Multipart |
45 | 48 | @POST("v1/images/edits") |
46 | 49 | Single<ImagesRensponse> imageEdits(@Part() MultipartBody.Part image, |
47 | 50 | @Part() MultipartBody.Part mask, |
48 | 51 | @PartMap Edits edits); |
49 | 52 |
|
50 | | - |
51 | 53 | /** |
52 | | - * image_variations |
| 54 | + * 图像变体 |
| 55 | + * Image variations |
53 | 56 | */ |
54 | 57 | @Multipart |
55 | 58 | @POST("v1/images/variations") |
56 | 59 | Single<ImagesRensponse> imageVariations(@Part() MultipartBody.Part image, |
57 | 60 | @PartMap Variations variations); |
58 | 61 |
|
59 | 62 | /** |
60 | | - * audio_transcriptions |
| 63 | + * 生成语音 |
| 64 | + * Create speech |
| 65 | + */ |
| 66 | + @POST("v1/audio/speech") |
| 67 | + Single<AudioResponse> audioSpeech(@Body SpeechRequest speechRequest); |
| 68 | + |
| 69 | + /** |
| 70 | + * 音频转录 |
| 71 | + * Audio transcriptions |
61 | 72 | */ |
62 | 73 | @Multipart |
63 | 74 | @POST("v1/audio/transcriptions") |
64 | 75 | Single<AudioResponse> audioTranscriptions(@Part() MultipartBody.Part audio, |
65 | 76 | @PartMap Transcriptions transcriptions); |
66 | 77 |
|
67 | 78 | /** |
68 | | - * audio_translations |
| 79 | + * 音频翻译 |
| 80 | + * Audio translations |
69 | 81 | */ |
70 | 82 | @Multipart |
71 | 83 | @POST("v1/audio/translations") |
72 | 84 | Single<AudioResponse> audioTranslations(@Part() MultipartBody.Part audio, |
73 | 85 | @PartMap Transcriptions transcriptions); |
74 | 86 |
|
75 | | - |
76 | 87 | /** |
77 | 88 | * 余额查询 |
| 89 | + * Credit grants query |
78 | 90 | */ |
79 | 91 | @GET("dashboard/billing/credit_grants") |
80 | 92 | Single<CreditGrantsResponse> creditGrants(); |
81 | 93 |
|
82 | 94 | /** |
83 | | - * 余额查询 |
| 95 | + * 订阅查询 |
| 96 | + * Subscription query |
84 | 97 | */ |
85 | 98 | @GET("v1/dashboard/billing/subscription") |
86 | 99 | Single<SubscriptionData> subscription(); |
87 | 100 |
|
88 | 101 | /** |
89 | | - * 余额查询 |
| 102 | + * 使用情况查询 |
| 103 | + * Usage query |
90 | 104 | */ |
91 | 105 | @GET("v1/dashboard/billing/usage") |
92 | 106 | Single<UseageResponse> usage(@Query("start_date") String startDate, |
93 | 107 | @Query("end_date") String endDate); |
94 | 108 |
|
95 | | - |
96 | 109 | /** |
97 | 110 | * 生成向量 |
| 111 | + * Create embeddings |
98 | 112 | */ |
99 | 113 | @POST("v1/embeddings") |
100 | 114 | Single<EmbeddingResult> createEmbeddings(@Body EmbeddingRequest request); |
101 | | - |
| 115 | + |
102 | 116 | } |
0 commit comments