Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(model-hub): ask OpenAI image generation for JPEG at quality 90 (#2580)

Call White7f9166b43074
diff --git a/docs/plans/agent-core-contracts/conversion-tables.md b/docs/plans/agent-core-contracts/conversion-tables.md
index 012676104..1a521ebf4 100644
--- a/docs/plans/agent-core-contracts/conversion-tables.md
+++ b/docs/plans/agent-core-contracts/conversion-tables.md
@@ -667,7 +667,7 @@ whole text block, so it carries no range.
| Concern | Anthropic Messages | OpenAI Responses (OpenAI, xAI) | OpenAI Chat Completions |
| --- | --- | --- | --- |
-| Native declaration (mode from `HopResolution.hosted_tools`) | `{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}` | `{"type": "web_search"}`; xAI also `{"type": "x_search"}`; OpenAI `{"type": "image_generation", "partial_images": 2}`; plus the overlay entry's `include` values (OpenAI web search: `web_search_call.action.sources`) | none. A `google` hop is reached over this Chat form, and the engine translates it to Gemini. |
+| Native declaration (mode from `HopResolution.hosted_tools`) | `{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}` | `{"type": "web_search"}`; xAI also `{"type": "x_search"}`; OpenAI `{"type": "image_generation", "partial_images": 2, "output_format": "jpeg", "output_compression": 90}`; plus the overlay entry's `include` values (OpenAI web search: `web_search_call.action.sources`) | none. A `google` hop is reached over this Chat form, and the engine translates it to Gemini. |
| Proxy declaration | `{"name": <tool>, "input_schema": <canonical>}` | `{"type": "function", "name": <tool>, "parameters": <canonical>}` | `{"type": "function", "function": {...}}` |
| Native result → `HostedToolBlock` | every item under a declared hosted tool, one block each, in stream order, mapped to a provider-neutral `action` by the rule in `../vibey-hosted-tools.md` §4.2. `server_tool_use` plus its `web_search_tool_result` → `search`; `encrypted_content` only in `native.payload`. | `web_search_call` `search` (`queries[]`, else `query`) / `open_page` / `find_in_page`; xAI `custom_tool_call` `x_keyword_search` / `x_semantic_search` / `x_user_search` / `x_thread_fetch`. The `tco_…` `reasoning` items stay thinking blocks. Unknown items become `other`, never dropped. | — |
| Response-level facts → `AssistantMessage.hosted_summary` | `usage.server_tool_use` counts | xAI `cost_in_usd_ticks` (reported once per response), `server_side_tool_usage_details` counts, and the X-search `url_citation`s as `cited_sources` | — |
diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.md
index 84937e421..96d72cb5a 100644
--- a/docs/plans/vibey-hosted-tools.md
+++ b/docs/plans/vibey-hosted-tools.md
@@ -251,7 +251,7 @@ verified for X search.
| Protocol | Native declaration | Proxy declaration |
| --- | --- | --- |
-| `openai_responses` (OpenAI, xAI) | `{"type": "web_search"}`, `{"type": "x_search"}`, `{"type": "image_generation", "partial_images": 2}`, plus the overlay entry's `include` values. OpenAI's web search requires `include: ["web_search_call.action.sources"]`, merged with Vibey's existing `reasoning.encrypted_content`; without it, `action.sources` is not returned. xAI's `web_search_call` carried `action.sources` without it (spike). | `{"type": "function", "name": "web_search", "parameters": <canonical>}` |
+| `openai_responses` (OpenAI, xAI) | `{"type": "web_search"}`, `{"type": "x_search"}`, `{"type": "image_generation", "partial_images": 2, "output_format": "jpeg", "output_compression": 90}`, plus the overlay entry's `include` values. OpenAI's web search requires `include: ["web_search_call.action.sources"]`, merged with Vibey's existing `reasoning.encrypted_content`; without it, `action.sources` is not returned. xAI's `web_search_call` carried `action.sources` without it (spike). | `{"type": "function", "name": "web_search", "parameters": <canonical>}` |
| `anthropic` | `{"type": "web_search_20250305", "name": "web_search", "max_uses": 5}` | `{"name": "web_search", "input_schema": <canonical>}` |
| `openai_chat`, `google` | none in Phase 1 | a function with the canonical schema. Vibey reaches a `google` hop over Chat Completions at the gateway (C-1 conversion tables), so the Chat form applies, and the engine translates it to Gemini `functionDeclarations`. |
@@ -569,9 +569,11 @@ Each has a **Re-verify** action with its cost. Unknown shows nothing.
- If the model wants to look, it opens the file with its `read` tool, the same as any other file.
- The file the record names must fit `read`'s inline image cap. `MAX_INLINE_IMAGE_BYTES` in
`core/agent_core/tools/read.py` is about 3.4 MiB, and `read` does not resize. A high-quality PNG of 4–6 MB would
- come back as "Image omitted". So either the declaration bounds the output (`output_format` and compression), or
- the store also writes a bounded preview and the record names it. The Phase 1 PR picks one and tests it with a
- 6 MB image.
+ come back as "Image omitted". Phase 1 bounds it in the declaration: OpenAI's asks for `output_format: "jpeg"`
+ at `output_compression: 90`, so a 1.6 MP image is about 0.3–1 MB, and every IM platform shows JPEG. An image
+ still over the cap gets a record saying it is too large to view inline.
+ - Known limitation: no transparent backgrounds in Phase 1. A later per-call format choice (an
+ `output_format`/`background` argument on the tool) restores them.
- **The user sees the image.** The Workbench renders it inline from the file, and IM attaches it. That is display,
separate from model context.
- **History and replay never contain base64.**
diff --git a/tests/test_model_hub_hosted_executor.py b/tests/test_model_hub_hosted_executor.py
index 2c0181705..5207ad752 100644
--- a/tests/test_model_hub_hosted_executor.py
+++ b/tests/test_model_hub_hosted_executor.py
@@ -360,7 +360,10 @@ async def test_a_proxied_image_returns_its_bytes_once_for_vibey_to_save(tmp_path
# Megabytes of base64 are never encoded on the controller loop.
assert encoding_threads and threading.main_thread() not in encoding_threads
sent = service.adapter.requests[0]
- assert sent["tools"] == [{"type": "image_generation", "partial_images": 2, "size": "1024x1024"}]
+ assert sent["tools"] == [{
+ "type": "image_generation", "partial_images": 2, "output_format": "jpeg", "output_compression": 90,
+ "size": "1024x1024",
+ }]
assert sent["tool_choice"] == {"type": "image_generation"}
assert "reasoning" not in sent
assert answer["record"] == {"status": "completed", "sources": []}
diff --git a/tests/test_provider_overlay.py b/tests/test_provider_overlay.py
index a5f7d8158..419ac7d8f 100644
--- a/tests/test_provider_overlay.py
+++ b/tests/test_provider_overlay.py
@@ -81,7 +81,7 @@ def test_bundled_providers_section_satisfies_its_schema():
"openai_responses",
" gpt-6-astra ",
"image_generation",
- ({"type": "image_generation", "partial_images": 2}, (), None),
+ ({"type": "image_generation", "partial_images": 2, "output_format": "jpeg", "output_compression": 90}, (), None),
),
(
"xai",
diff --git a/vibe/data/backend_models.json b/vibe/data/backend_models.json
index 522227fa4..7873c1c52 100644
--- a/vibe/data/backend_models.json
+++ b/vibe/data/backend_models.json
@@ -76,7 +76,7 @@
"price": {"unit": "call", "usd_per_1k": 10, "as_of": "2026-10-13", "url": "https://developers.openai.com/api/docs/pricing"}
},
"image_generation": {
- "declaration": {"type": "image_generation", "partial_images": 2}
+ "declaration": {"type": "image_generation", "partial_images": 2, "output_format": "jpeg", "output_compression": 90}
}
}
}