#pragma once // ResponsesService (POST /responses, beta) and MessagesService (POST // /messages, the Anthropic-compatible skin). Bodies are JSON objects checked // against the call table (calls.h); the request shapes of these two skins are // large and owned by their respective protocols, so they are not re-modelled // field by field. Routing fields (provider, models, route, plugins, trace, // session_id) are the same objects ChatParams builds: use ProviderPreferences, // plugins_to_json and friends to fill them. #include #include "openrouter/gateway.h" #include "openrouter/stream_summary.h" namespace molo::openrouter { class ResponsesService : public Endpoint { public: explicit ResponsesService(std::shared_ptr g) : Endpoint(std::move(g)) {} // Non-streaming. Throws on HTTP errors, on a top-level error object and on // a response whose status is "failed". Json create(const Json& body) const; // Streaming. `on_text` gets each text delta and the raw event; return false // to stop. The summary holds text, reasoning, usage and status. A failed // response or `error` event is thrown after delivery. StreamSummary stream(const Json& body, const std::function& on_text) const; }; class MessagesService : public Endpoint { public: explicit MessagesService(std::shared_ptr g) : Endpoint(std::move(g)) {} // `model` and `messages` are required by the spec. Json create(const Json& body) const; StreamSummary stream(const Json& body, const std::function& on_text) const; }; } // namespace molo::openrouter