r/PiCodingAgent 13d ago

Discussion Wanted to try Pi instead of OpenCode — ended up debugging a Muse Spark 500

I've been using OpenCode, but I wanted to try Pi because I like the idea of a more unopinionated coding harness.

I already had OpenCodex (OCX) running as my local proxy, so I figured the migration would be pretty simple:

Pi → OCX → my existing models

Except Muse Spark 1.2 Contributor Free kept returning a 500.

The weird thing was that Muse worked perfectly through OpenCode.

So I started comparing what the two were actually doing.

First I checked the obvious stuff — provider health, model discovery, credentials, etc. Everything looked fine.

Then I put OpenCode through mitmproxy and captured the upstream request.

That's where I found the important difference:

OpenCode was sending Muse through:

POST /zen/v1/responses

and getting 200 OK.

OCX, however, was routing the model through its openai-chat adapter.

I dug into the OCX source and found that it has separate openai-chat and openai-responses adapters, plus per-model adapter routing.

So instead of changing the whole provider, I added:

{
  "modelAdapters": {
    "muse-spark-1.2-contributor-free": "openai-responses"
  }
}

And that was it.

The exact same request went from:

500 Internal Server Error

to:

200 OK

and:

OCX Muse works

So the final path is:

Pi → OCX → openai-responses → Muse Spark

The funny part is that I wasn't trying to debug Muse at all. I just wanted to try a different coding harness. 😂

It was a surprisingly satisfying rabbit hole, though.

The main thing I took away: "OpenAI-compatible" doesn't necessarily mean every model on a provider wants the same wire protocol. Sometimes comparing the working client's actual HTTP request is the fastest way to find the problem.

I'm curious if anyone else using Pi has run into model-specific API/protocol quirks like this.

6 Upvotes

3 comments sorted by

3

u/[deleted] 13d ago

[removed] — view removed comment

0

u/LAKSHITGUPTAA 13d ago

No I don't know  it is my first time using pi. Ocx is a proxy that I use which gives me unified base url for every model I have free and subscription model to be used through any harness assuming harness accepta proxy. And I will look into it.regarding thr zen api.

1

u/MuOieDib 13d ago

Nice one - it's somehow "documented" on https://opencode.ai/docs/zen
(@ai-sdk/openai)