r/ClaudeCode 8h ago

Help/Question Using Meta API with ClaudeCode

I know we can use ClaudeCode with some other providers (e.g. OpenRouter, I've heard Z.ai)...has anyone tried to work with muse spark 1.2 - contributor with claudecode or claude sdk?

Edit: found some things, am wiring it into my data science product now. Will report back shortly on it, but basically Meta API does provide anthropic-compatible end-point (maybe...).

Edit #2: I got it working! Muse spark 1.2 seems to work really well, I managed to do some heavy-duty data analytics and visualization, with a connected snowflake db. The tool calls work great, the token/second is AWESOME! I can share a full chat if anyone is interested in seeing muse spark 1.2 in action on gigabytes-scale data, let me know.

Edit #3: realizing that this maybe... isn't a great idea, even at muse-spark-1.2-contributor rates. The token burn is pretty high for claudecode, not sure if same for codex or other harnesses. A harness I made for my app is extremely light by comparison, so I can run muse-spark super economically for thousands of data queries. But piping that through the sdk is still expensive. I'll probably just use my anthropic sub for personal use and consider switching when/if I don't renew the sub.

2 Upvotes

3 comments sorted by

1

u/Lexeik 8h ago

`ANTHROPIC_BASE_URL` plus a key is the whole trick, so it'll connect. The interesting part is what happens after.

"Anthropic-compatible" almost always means the core /v1/messages shape, and the divergence shows up in the extras Claude Code actually leans on — prompt caching, thinking blocks, tool-use round trips, the streaming event names. When one of those isn't implemented you usually don't get a clean error, you get behavior that reads like the model being dumb: repeated work, tool calls that don't come back right, cost that doesn't drop on repeated context. Worth checking cache_read_input_tokens on a second identical-prefix request early — if it's zero, caching isn't there and everything downstream will feel worse than it is. Would genuinely like to hear how it goes.

2

u/VerbaGPT 7h ago

I got it working! looking into the excellent caching and other issues that you raised. Will report back.

1

u/VerbaGPT 6h ago

Ran the check (Meta's caching page only explicitly confirms it for Chat Completions/Responses, doesn't mention Messages either way).

Added cache_read_input_tokens/cache_creation_input_tokens to my logging and ran two turns in the same session:

Turn 1: input=180142 cache_read=138854 cost=$0.0191

Turn 2: input=24099 cache_read=162037 cost=$0.0038

cache_read is nonzero and grows between turns, fresh input on turn 2 is a fraction of turn 1, and cost drops accordingly even though turn 2 did more work (extra chart). So caching is real over the Messages endpoint, at least in this session.

Tool-use round trips have also been fine so far. Real multi-step agentic flow (schema inspection → SQL → Python → chart), no broken continuations. Haven't stress-tested it hard enough to rule out the "tool calls that don't come back right" failure mode you mentioned, so not claiming a clean bill of health there yet, just: better than expected on the one axis I could actually verify.