Skip to content

OpenAI Responses and Realtime API - #14

Merged
Netdex merged 5 commits into
masterfrom
responses
Jun 25, 2026
Merged

OpenAI Responses and Realtime API#14
Netdex merged 5 commits into
masterfrom
responses

Conversation

@Netdex

@Netdex Netdex commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Compared to when I implemented this in #5 a year ago, the realtime models from OpenAI have improved a lot and are actually usable for translation purposes now.

  • ba50f75 openai: require all properties in strict tool-schema test — independent test-correctness fix.
  • 7640fc5 openai: add Responses API client — responses:: protocol + client, plus ReasoningEffort::Xhigh.
  • 25aecc3 openai: add Realtime API client — realtime:: WebSocket client over tokio-tungstenite, estimate_text_tokens, new error variants, the Cargo dep/lock bump.
  • 655f43f openai: add cross-backend latency benchmark example — bench_latency.rs (needs both clients present, so it lands after them). I also fixed a stale OutputTextDelta pattern that didn't account for the new response_id field.
  • 97f8107 niinii: integrate Responses and Realtime backends behind a Backend trait — the app-side integration: Backend trait, shared render/config types moved into translator/mod.rs, the two new backends + views, shared openai_api_endpoint/openai_model settings, the test config-key rename, and the CLAUDE.md update.

Netdex and others added 5 commits June 24, 2026 21:18
Strict function schemas require every key in `properties` to appear in
`required`; add the missing `unit` so the chat tool-call test reflects
the API contract.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a client for the OpenAI Responses API (`responses::`): request/response
protocol types, streaming `StreamEvent`s, and the request builder. Latency
knobs are first-class -- streaming, `service_tier`, `reasoning.effort`,
opt-in reasoning summary, and a `prompt_cache_key`. Also add the GPT-5.5
`ReasoningEffort::Xhigh` level.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a WebSocket client for the OpenAI Realtime API (`realtime::`) over
tokio-tungstenite: session/client/server protocol types, the persistent
connection, and `RealtimeTruncation` for conversation-truncation control.
Add `estimate_text_tokens` (o200k_base) for UI token display and
`Error::{Tungstenite,Realtime}`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `examples/bench_latency.rs` measuring time-to-first-token (plus TTFB
and total duration) across the Realtime, Responses, and Chat Completions
backends under minimum-latency settings, reusing one persistent WebSocket
for the realtime session. Reads config from the workspace niinii.toml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a backend-agnostic `Backend` trait (translator/mod.rs) and move the
shared render/config types (`ExchangeId`, `Response`, `ExchangeView`,
`UsageView`, `TranslateConfig`) out of the chat backend so the UI and the
VNDB addendum wiring no longer name a concrete handle. `chat` keeps its
local context buffer; `responses` chains turns server-side via
`previous_response_id`; `realtime` runs an always-streaming WebSocket
session with configurable truncation.

Promote `openai_api_endpoint` and `openai_model` to shared top-level
settings (used by all backends) and add `ResponsesSettings` /
`RealtimeSettings` with latency-oriented defaults. Wire the new backends
into the settings/translator views and select among them via
`Settings::translator_type`. Update the openai integration-test config
loader to the renamed shared keys, and refresh CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Netdex Netdex changed the title Responses OpenAI Response and Realtime API Jun 25, 2026
@Netdex Netdex changed the title OpenAI Response and Realtime API OpenAI Responses and Realtime API Jun 25, 2026
@Netdex
Netdex merged commit 9817484 into master Jun 25, 2026
1 check passed
@Netdex
Netdex deleted the responses branch June 25, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant