Skip to content

Feature Request: Support embeddings and OpenAI Realtime API endpoints #53

Description

@iXandru

Summary

Feature request: please add/verify OpenAI-compatible support for embeddings and the current OpenAI Realtime API surface in LLM-API-Key-Proxy.

I’m using this proxy as the OpenAI-compatible gateway in front of tools that expect more than chat completions. The main immediate use case is Gbrain as an OpenClaw memory/context engine:

I checked a local Gbrain clone before rewriting this. Gbrain’s AI gateway supports OpenAI/openai-compatible embedding providers and calls the standard embeddings route for openai-compatible providers. In the relevant path, it posts to:

  • POST {baseUrl}/embeddings

So when the configured base URL includes /v1, the proxy needs to expose:

  • POST /v1/embeddings

Without that, Gbrain/OpenClaw memory indexing and semantic search can’t route cleanly through the proxy.

Why this matters

For OpenClaw, Gbrain is intended to act as the long-term memory / context engine: importing content, embedding it, and serving hybrid semantic search over that context. That makes the embeddings endpoint a core compatibility requirement, not a nice-to-have.

Realtime support is the second compatibility gap. Live voice / realtime clients use different transports and body types from ordinary /v1/chat/completions or /v1/responses, so supporting only normal JSON chat routes is not enough for OpenAI-compatible realtime model usage.

Requested endpoint support

1. Embeddings

  • POST /v1/embeddings

Expected behavior:

  • Forward OpenAI-compatible embedding requests and responses without assuming chat-completion semantics.
  • Preserve request fields such as model, input, and dimensions where provided.
  • Support normal OpenAI-style responses shaped like data[].embedding plus usage metadata.

Minimal acceptance:

  • Gbrain can configure an openai-compatible embedding provider pointed at the proxy and successfully embed text through POST /v1/embeddings.

2. Realtime HTTP setup/control endpoints

Please add passthrough support for the current OpenAI Realtime HTTP endpoints, especially:

  • POST /v1/realtime/client_secrets
    • Used to mint ephemeral client secrets for browser/mobile/WebRTC/WebSocket clients.
    • Should support session types such as realtime and transcription.
  • POST /v1/realtime/calls
    • Used for WebRTC SDP setup.
    • Important: this may use Content-Type: application/sdp, so the proxy should not force JSON-only body handling.
  • POST /v1/realtime/transcription_sessions
    • Used for transcription-only realtime sessions / ephemeral credentials.
  • POST /v1/realtime/sessions
    • Older/beta-style realtime session creation; useful for compatibility with clients that have not fully migrated.
  • POST /v1/realtime/translations
    • Useful if the proxy aims to cover realtime translation flows too.

3. Realtime WebSocket endpoint

  • GET /v1/realtime as a WebSocket upgrade endpoint

Expected behavior:

  • Preserve query parameters such as ?model=... or ?intent=transcription.
  • Support bidirectional WebSocket forwarding.
  • Preserve relevant auth, subprotocol, and beta/GA headers where applicable.
  • Do not buffer or reinterpret realtime event frames as normal HTTP JSON.

4. Streaming passthrough

Please ensure streaming/chunked/SSE responses are forwarded incrementally rather than buffered until completion, including:

  • POST /v1/chat/completions with stream: true
  • streaming POST /v1/responses
  • any realtime-related streaming response paths where applicable

Implementation notes / gotchas

  • Realtime is transport-specific. WebRTC setup uses SDP bodies; WebSocket sessions need HTTP upgrade; normal route forwarding alone will not cover it.
  • Ephemeral client secrets should not be logged as plaintext.
  • Embeddings should not be routed through chat-completion request/response handling.
  • A robust approach may be path/method based passthrough that preserves body type, content type, streaming behavior, and upgrade semantics.

Minimal acceptance criteria

  • POST /v1/embeddings through the proxy returns an OpenAI-compatible embeddings response.
  • Gbrain can use the proxy as an openai-compatible embedding base URL for memory/context indexing.
  • POST /v1/realtime/client_secrets can mint ephemeral realtime credentials through the proxy.
  • POST /v1/realtime/calls can pass WebRTC SDP setup through the proxy.
  • wss://<proxy>/v1/realtime?model=... can upgrade and forward bidirectional realtime events.
  • Streaming responses are forwarded incrementally rather than buffered.

Thanks for maintaining this project — this would make it much more useful as a real OpenAI-compatible gateway for agent stacks, not just chat routing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions