Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ auto token = client.tokens().create(opts);
decart::ClientOptions options;
options.apiKey = "sk-..."; // or set DECART_API_KEY
options.baseUrl = "https://api.decart.ai"; // HTTP API (tokens)
options.realtimeBaseUrl = "wss://api3.decart.ai"; // signaling
options.realtimeBaseUrl = "wss://api.decart.ai"; // signaling
options.integration = "my-app"; // included in the User-Agent
decart::Client client(options);
```
Expand Down
2 changes: 1 addition & 1 deletion include/decart/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct ClientOptions {
std::string apiKey;
/// Override the HTTP API base URL (default "https://api.decart.ai").
std::string baseUrl;
/// Override the realtime signaling base URL (default "wss://api3.decart.ai").
/// Override the realtime signaling base URL (default "wss://api.decart.ai").
std::string realtimeBaseUrl;
/// Optional integration identifier, included in the User-Agent.
std::string integration;
Expand Down
2 changes: 1 addition & 1 deletion src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Client::Client(ClientOptions options) : impl_(std::make_unique<Impl>()) {
}

std::string realtimeBaseUrl =
options.realtimeBaseUrl.empty() ? "wss://api3.decart.ai" : options.realtimeBaseUrl;
options.realtimeBaseUrl.empty() ? "wss://api.decart.ai" : options.realtimeBaseUrl;
if (!startsWith(realtimeBaseUrl, "ws://") && !startsWith(realtimeBaseUrl, "wss://")) {
throw Exception(Error{ErrorCode::InvalidBaseUrl,
"Invalid realtime base URL (must be ws:// or wss://): " + realtimeBaseUrl});
Expand Down
2 changes: 1 addition & 1 deletion src/detail/client_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace decart::detail {
struct ClientConfig {
std::string apiKey;
std::string baseUrl; // e.g. "https://api.decart.ai"
std::string realtimeBaseUrl; // e.g. "wss://api3.decart.ai"
std::string realtimeBaseUrl; // e.g. "wss://api.decart.ai"
std::string integration;
};

Expand Down
2 changes: 1 addition & 1 deletion src/detail/signaling_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct RoomInfo {
std::string sessionId;
};

/// The Decart realtime signaling channel: a WebSocket to `wss://api3.decart.ai`
/// The Decart realtime signaling channel: a WebSocket to `wss://api.decart.ai`
/// that performs the join handshake, carries prompt/image control messages
/// (request/ack), and forwards server events. Media flows separately over
/// LiveKit. See [[decart-realtime-wire-protocol]].
Expand Down
12 changes: 6 additions & 6 deletions tests/test_stream_url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using namespace decart::detail;

namespace {

const std::string kBase = "wss://api3.decart.ai";
const std::string kBase = "wss://api.decart.ai";
const std::string kKey = "sk-test";

std::size_t count(const std::string& haystack, const std::string& needle) {
Expand All @@ -39,36 +39,36 @@ struct LogCapture {
TEST_CASE("buildStreamUrl without options is unchanged and carries no speed param") {
const auto model = models::realtime("lucy-2.5");
const auto url = buildStreamUrl(kBase, model, kKey, std::nullopt, std::nullopt);
CHECK(url == "wss://api3.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5");
CHECK(url == "wss://api.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5");
CHECK(url.find("speed") == std::string::npos);
CHECK(url.find("resolution") == std::string::npos);
}

TEST_CASE("buildStreamUrl appends resolution after model") {
const auto model = models::realtime("lucy-2.5");
const auto url = buildStreamUrl(kBase, model, kKey, std::string("1080p"), std::nullopt);
CHECK(url == "wss://api3.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&resolution=1080p");
CHECK(url == "wss://api.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&resolution=1080p");
}

TEST_CASE("buildStreamUrl appends speed=fast exactly once, after resolution") {
const auto model = models::realtime("lucy-2.5");

SUBCASE("speed only") {
const auto url = buildStreamUrl(kBase, model, kKey, std::nullopt, Speed::Fast);
CHECK(url == "wss://api3.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&speed=fast");
CHECK(url == "wss://api.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&speed=fast");
CHECK(count(url, "speed=") == 1);
}

SUBCASE("speed with resolution") {
const auto url = buildStreamUrl(kBase, model, kKey, std::string("720p"), Speed::Fast);
CHECK(url == "wss://api3.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&resolution=720p&speed=fast");
CHECK(url == "wss://api.decart.ai/v1/stream?api_key=sk-test&model=lucy-2.5&resolution=720p&speed=fast");
CHECK(count(url, "speed=") == 1);
}

SUBCASE("still sent for models without the capability (server ignores it)") {
const auto restyle = models::realtime("lucy-restyle-2");
const auto url = buildStreamUrl(kBase, restyle, kKey, std::nullopt, Speed::Fast);
CHECK(url == "wss://api3.decart.ai/v1/stream?api_key=sk-test&model=lucy-restyle-2&speed=fast");
CHECK(url == "wss://api.decart.ai/v1/stream?api_key=sk-test&model=lucy-restyle-2&speed=fast");
}
}

Expand Down
Loading