feat(gresiq-sdk): add create_model for self-registering fine-tunes
Lets a caller register a model into the GresIQ catalog (e.g. right after uploading a fine-tuned GGUF to Hugging Face) so it can then be targeted by assign_model. Bumped to 0.4.9; not yet published to crates.io. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
keypair34 committed
Jul 11, 2026 at 17:59 UTC
f126fe7385231ba7ebd86b33a1449c828c4d82e6
4 files changed
+58
-3
Cargo.lock
+1
-1
@@ -2519,7 +2519,7 @@ dependencies = [
2519
2520
[[package]]
2521
name = "smbcloud-gresiq-sdk"
2522
-version = "0.4.8"
2522
+version = "0.4.9"
2523
dependencies = [
2524
"anyhow",
2525
"log",
crates/smbcloud-gresiq-sdk/Cargo.toml
+1
-1
@@ -1,6 +1,6 @@
1
[package]
2
name = "smbcloud-gresiq-sdk"
3
-version = "0.4.8"
3
+version = "0.4.9"
4
edition = "2021"
5
description = "Rust client for the smbCloud GresIQ REST gateway — API-key auth, app management, and model assignment for Onde Inference."
6
license = "Apache-2.0"
crates/smbcloud-gresiq-sdk/src/onde_apps.rs
+54
@@ -42,6 +42,33 @@ pub struct OndeModel {
42
pub format: Option<String>,
43
pub approx_size_bytes: Option<i64>,
44
pub description: Option<String>,
45
+ /// `true` if this row was self-registered by a client (e.g. a fine-tune
46
+ /// pushed to Hugging Face) rather than one of the official catalog
47
+ /// models. Private to the registering user — other clients never see it.
48
+ #[serde(default)]
49
+ pub custom: bool,
50
+}
51
+
52
+/// Parameters for registering a new model into the catalog via
53
+/// [`create_model`]. The new row is private to the calling user.
54
+#[derive(Debug, Clone, Serialize)]
55
+pub struct CreateModelParams<'a> {
56
+ pub hf_repo_id: &'a str,
57
+ pub name: &'a str,
58
+ pub org: &'a str,
59
+ pub family: &'a str,
60
+ pub parameter_class: &'a str,
61
+ pub format: &'a str,
62
+ pub gguf_file: Option<&'a str>,
63
+ pub modality: Option<&'a str>,
64
+ pub description: Option<&'a str>,
65
+ pub approx_size_bytes: Option<i64>,
66
+}
67
+
68
+// POST /models body shape: { "gresiq_model": { ... } }
69
+#[derive(Serialize)]
70
+struct CreateModelBody<'a> {
71
+ gresiq_model: CreateModelParams<'a>,
72
}
73
74
// The models endpoint wraps its array: { "models": [...] }.
@@ -181,6 +208,33 @@ pub async fn list_models(
208
.models)
209
}
210
211
+/// Register a new model into the catalog, private to the calling user.
212
+///
213
+/// Typical use: right after uploading a fine-tuned GGUF to Hugging Face, so
214
+/// it can then be targeted by [`assign_model`].
215
+///
216
+/// `POST /v1/client/gresiq/models` — body: `{ "gresiq_model": { ... } }`
217
+pub async fn create_model(
218
+ environment: &Environment,
219
+ app_id: &str,
220
+ app_secret: &str,
221
+ access_token: &str,
222
+ params: CreateModelParams<'_>,
223
+) -> Result<OndeModel, GresiqError> {
224
+ let url = endpoint(environment, "models", app_id, app_secret);
225
+ let body = CreateModelBody {
226
+ gresiq_model: params,
227
+ };
228
+ let response = reqwest::Client::new()
229
+ .post(&url)
230
+ .header("Authorization", bearer(access_token))
231
+ .header("Content-Type", "application/json")
232
+ .json(&body)
233
+ .send()
234
+ .await?;
235
+ Ok(check(response).await?.json::<OndeModel>().await?)
236
+}
237
+
238
/// Rename an existing app.
239
///
240
/// `PATCH /v1/client/gresiq/apps/{onde_app_id}` — body: `{ "gresiq_app": { "name": "..." } }`
crates/smbcloud-gresiq-sdk/src/smbcloud_gresiq_sdk.rs
+2
-1
@@ -44,6 +44,7 @@ pub use client::{DocumentQuery, GresiqClient, GresiqDocument};
44
pub use client_credentials::{base_url, GresiqCredentials};
45
pub use error::GresiqError;
46
pub use onde_apps::{
47
- assign_model, create_app, list_apps, list_models, rename_app, OndeApp, OndeModel,
47
+ assign_model, create_app, create_model, list_apps, list_models, rename_app, CreateModelParams,
48
+ OndeApp, OndeModel,
49
};
50
pub use smbcloud_network::environment::Environment;