fix: make the integration work against a Claude proxy
validate / hassfest (push) Failing after 32s
validate / hacs (push) Failing after 1m50s
test / pytest (push) Successful in 3m56s

- Treat an empty tool argument string as no parameters instead of raising
  JSONDecodeError; the proxy sends "" for tools like the timer status
  (upstream issue #3).
- Do not replay earlier web searches in the history. The chat log keeps only
  their status, and a search without results makes the model disown the
  answers it based on it and search again (upstream issue #4).
- Look up the home location for web search with the subentry's model instead
  of gpt-4o-mini, and save the options without city/region if the lookup
  fails (upstream issue #5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pc-heiniandClaude Opus 5.5 committed 2026-10-22 08:38:01 +02:00
1 parent 8737e5d4ec
commit 235c536cab
6 files changed
+224 -70

No files matched your search

+17
View File
@@ -4,6 +4,23 @@
[![validate](https://github.com/adamjs83/ha-openai-compatible/actions/workflows/validate.yaml/badge.svg)](https://github.com/adamjs83/ha-openai-compatible/actions/workflows/validate.yaml)
[![HACS: custom](https://img.shields.io/badge/HACS-custom-41BDF5.svg)](https://hacs.xyz)
> **Fork of [adamjs83/ha-openai-compatible](https://github.com/adamjs83/ha-openai-compatible) v0.2.1**
> with fixes for running it against a proxy that serves Claude models. Drop it once
> upstream has fixed these issues:
>
> - [#3](https://github.com/adamjs83/ha-openai-compatible/issues/3): a tool call with an
> empty argument string (tools without parameters) is treated as `{}` instead of
> raising `JSONDecodeError`.
> - [#4](https://github.com/adamjs83/ha-openai-compatible/issues/4): earlier web searches
> are not replayed in the history; they carry no results, and the model then disowns
> its own answers and searches again.
> - [#5](https://github.com/adamjs83/ha-openai-compatible/issues/5): the home location
> lookup for web search uses the subentry's model instead of `gpt-4o-mini`, and a
> failed lookup no longer blocks saving the options.
>
> HACS only installs from GitHub, so this fork is installed by copying
> `custom_components/openai_compatible` into the Home Assistant config.
Home Assistant's built-in **OpenAI** integration, with one change that matters: the
**API base URL is configurable**. Point Home Assistant's conversation agent, AI Task,
speech-to-text and text-to-speech at any OpenAI-compatible endpoint — LiteLLM, vLLM,