I’d really like to test gpt-5-codex in openhands, ...
# proj-agent
l
I’d really like to test gpt-5-codex in openhands, but I think it only works with the responses API. @calm-artist-7206 and @chilly-france-44439 which method do you think we should take here? https://github.com/All-Hands-AI/agent-sdk/issues/138 We have a couple PRs open with different strategies: • https://github.com/All-Hands-AI/OpenHands/pull/10451 • https://github.com/All-Hands-AI/agent-sdk/pull/452 I don’t have a strong preference either way so maybe we should just pick one and go with it
w
does litellm not support it? or they still maintain the responses format?
l
i think the responses api is different enough that litellm didn’t try to match it with the completions api
(although I haven’t looked into this deeply)
c
I think engel has a pr in progress that we've worked on for quite a while
adn we had some discussion under this thread too: https://github.com/All-Hands-AI/agent-sdk/issues/138
i think we decide to maintain our own converter, just in case we want to support switching models on the fly in the futrue
c
Wow, indeed it seems OpenAI made this model /responses only
Copy code
⚠️ stream error: unexpected status 400 Bad Request: {"error":{"message":"litellm.BadRequestError: OpenAIException - This model is
only supported in v1/responses and not in v1/chat/completions.. Received Model Group=openai/gpt-5-codex\nAvailable Model Group Fallbacks=None","type":"invalid_request_error","param":"model","code":"400"}}; retrying 1/5 in 199ms
l
yep, i tried it right when i came out which is why i opened the pr on the agent sdk
c
Litellm has a bridge, but it’s… the other way around: client code can call responses() and it routes to completion()
I think maybe that one helps us to switch models too
This means we should support the
/responses
path fully 🤔
thinky spin 1
So this is what I see is happening here: OpenAI really wants to turn the industry away from /completions and to /responses. Responses API, as designed: • seems indeed better designed than /completions for these llm uses / agentic • is a superset of /completions, which should make migration easy • but! it defaults to storing conversations on openai servers • and making use of that (“don’t handle context yourselves, we do it for ya”) • although the API also has stateless mode, that one it tucked away, not much publicized • they push really hard, in docs, in code, to move to their stateful responses • an incredible sign of market power was that they nerfed GPT-5 when used on /completions, just to push people to the, apparently, a bit more performant/fast version
One thing we’re working hard on, is to do the conversion from Responses to completions, in other words, the “wrong way” according to openai lolsob
Just kidding there, but it’s true that we’re trying to push a superset of features into a subset, which loses information, while keeping track of the information in some way. I think maybe we need to just support it as it is, and then wrap both into our types as @curved-angle-80449 started to do
And now they seem to have made available GPT-5-codex only on /responses… I do know OpenAI was saying, recently! that “we know tens of thousands rely on /completions, we will support /completions indefinitely, for the foreseable future” …Ahem? thinky spin
l
Thanks for the summary Engel! I also don’t like openai forcing us to do things, but if completions is a subset of responses, i think it makes sense to call responses and rely on litellm’s converter. it seems pretty simple right?
c
Yes, we were discussing that previously in the issue Xingyao linked, with a wrinkle though: in years of use, other providers have tucked on top of /completions their own stuff, and it’s sometimes important. Of course from openai perspective, that doesn’t count, heh, but that’s things like Anthropic thinking blocks, I think, things we actually need. So in practice, for us, it’s no longer a superset. Or a superset with exceptions 😂
But I do like that perspective!
I’ll bring the PR back to stable to see what we think
l
OK, thanks a lot. And I guess I’ll close my PR
c
engel, lmk if you need any help reviewing/getting it merged
👍 1
irrc it was pretty close last time
c
Graham, I feel like the approach in your PR may be option 2 (support fully and separately; not: go with /responses and convert) and it started clean, but it’s not totally obvious yet to me because it just started. Up to you, your PR could do it better, it just seems like it also has a lot of work left to do, and atm maybe it duplicates a bit?
l
no, please go ahead!
I’ve closed mine
c
Xingyao, on it. We merged the typed message parts PR into the conversion PR, and it lead to bugs: anthropic prompt caching got lost, pydantic discriminator used a validator for the union of types that is not serializable so it crashed in a litellm deepcopy, fun! I think I’ve fixed them now, we’ll see. In parallel, I actually worked on splitting that strong types PR to maybe merge before. It actually feels like a separate issue
l
Hello! I just wanted to check on the responses API. I’m pretty eager to check out gpt-5-codex and am happy to help in any way I can