Repository navigation
Murmury: one OpenAI client for eight answer services in a live call app (OpenAI, Gemini, Groq, Ollama...) #4336
GianlucaBave
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Murmury is an open-source Mac app (GPL-3.0) that listens to the other side of a video call, transcribes it locally with Whisper, and shows a short answer from your own documents when someone asks you something. Besides Anthropic, every answer service goes through this SDK: OpenAI, Gemini, xAI, Groq, Mistral, OpenRouter, and local models in Ollama and LM Studio, all with one
OpenAI(api_key=..., base_url=...)client.A few things that made one client work across eight services, in case they help someone doing the same:
1. Drop the optional fields a service refuses, then retry. Services accept different extras (
stream_options,reasoning_effort, provider-specific options). Instead of a table per service, the request starts with all of them, and onopenai.BadRequestErrorthe fields named in the error are removed and the call is repeated. If the error names none, all optional fields go. After the first refusal the call stays clean. (code)2. Ask for as little reasoning as the model allows. A live answer can't wait for thinking.
reasoning_effortis"none"for GPT-5.1 and later,"minimal"for GPT-5,"low"for gpt-oss on Groq, and"none"for Ollama. With qwen3:8b on Ollama, the time to the first token went from 15 s to 0.23 s with"none"(measured on an M5).3.
stream_options={"include_usage": True}for the cost line. The last chunk carriesprompt_tokens_details.cached_tokens, so the app can show how much of the documents was read from the provider's cache.4.
max_completion_tokensfor OpenAI,max_tokensfor the rest. Most OpenAI-compatible servers still expect the older name.5. Close the stream when the line wasn't a question. The answer itself starts with SKIP when the line heard isn't a question, so the app stops reading and calls
stream.close()in afinally, which also ends the request.The model list in the setup screen is
client.models.list()on the same base URL, which works with Ollama and LM Studio too.Feedback is welcome, and if anyone has a cleaner way to find out which optional fields a compatible server accepts, I'd like to hear it.
All reactions