()
| 17 | }, |
| 18 | ], |
| 19 | async authorize() { |
| 20 | return { |
| 21 | method: "code", |
| 22 | instructions: |
| 23 | "Open ChatGPT/Codex authorization and paste the returned code/token here.", |
| 24 | callback: async (code?: string) => { |
| 25 | const value = code?.trim(); |
| 26 | if (!value) return { type: "failed" }; |
| 27 | return { |
| 28 | type: "success", |
| 29 | access: value, |
| 30 | refresh: value, |
| 31 | expires: Date.now() + 3600 * 1000, |
| 32 | }; |
| 33 | }, |
| 34 | }; |
| 35 | }, |
| 36 | async loader() { |
| 37 | const key = process.env.OPENAI_API_KEY?.trim(); |
| 38 | if (!key) return {}; |