chatgpt plus/pro subscription#1260
Conversation
|
@alesya-h Thanks for the PR! This needs a bit of work but looks like a good start. Between this,
I'll take a closer look at the code when I can. |
|
Hi. Thanks for looking into it. Regarding same vs different backend, the thing is it's not just oauth, it uses a different set of api endpoints that return data in a different format than normal completions api, and need to be converted. If it would be just auth flow I would totally agree, but given this, i am not so sure. Even the list of models available via regular openai api vs codex api is different. |
|
EDIT3: building on top of #1292, I have a branch which adds chatgpt-codex and deduplicates some oauth related functions from |
|
+1 to this! would be neat to use my chatgpt plus/pro subscription. |
|
Lovely, just asked codex to patch my local gptel with this :-) |
|
This is working great for me, just one problem. It always sets and the callback is never called, GPT's explanation is: instead I think the openai backend should error and say it doesn't support non-streaming requests, when it is called with |
|
This is working great for me, just one problem. It always sets `:stream t` when it makes the request, which I think is correct as it seems the codex api doesn't support non-streaming requests.
If the Codex API doesn't support non-streaming requests, you'll have to write a streaming callback. This is not significantly different from your callback example. It will be called many times so you have to accumulate the message somewhere. When the streaming ends it will be called with t as the response, you can deliver the full response then.
I can look into addressing this more generally when I add Codex support. (But before that I need to figure out gptel-oauth.)
|
|
I did write a streaming callback and it's working great, I just think it should error rather than silently never calling the callback when you use it with |
|
This PR also has an issue where it is not converting tool calls from the chat conversations to responses API format. I made a branch based on this at https://github.com/bo-tato/gptel/tree/codex-oauth which based this on the new |
|
Added support for OpenAI/chatgpt/codex plus/pro subscription, whatever it's called now: 56e5b06. It's not very robust yet, so please give it a good kicking if you can. Use @alesya-h Thank you for this PR. I'm closing it now as not planned (or required), but grabbing the various endpoints, IDs and auth results from this PR saved me a lot of work since this is a private OpenAI API and information about it is scattered across the web. |
|
all good, thank you! |
This is based on the implementation from opencode. It's vibe-coded, but it works really well, including oauth login, even in non-gui emacs (oauth uses a code that you type, not just "open this thing in a browser"). client id is that of the official codex app (which is opensource), and it's what opencode uses as well.
(sorry for the second PR, I tried to fix the fact that I committed to master, but github doesn't allow editing the source branch after PR is created. I hoped it'll update it if I renamed my master via the web ui, but it just declined that PR instead)