Skip to content

Commit 4158928

Browse files
committed
feat(providers): add Docker Model Runner provider
Add model-runner as a built-in inference provider so agents running inside OpenShell sandboxes can route inference requests to the local Docker Model Runner daemon via model-runner.docker.internal:80. No credentials are required; Docker Model Runner is accessed over the Docker-internal network without authentication by default.
1 parent b33bbd2 commit 4158928

5 files changed

Lines changed: 54 additions & 0 deletions

File tree

crates/openshell-providers/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ impl ProviderRegistry {
9191
registry.register(providers::nvidia::NvidiaProvider);
9292
registry.register(providers::gitlab::GitlabProvider);
9393
registry.register(providers::github::GithubProvider);
94+
registry.register(providers::model_runner::ModelRunnerProvider);
9495
registry.register(providers::outlook::OutlookProvider);
9596
registry
9697
}
@@ -153,6 +154,7 @@ pub fn normalize_provider_type(input: &str) -> Option<&'static str> {
153154
"nvidia" => Some("nvidia"),
154155
"gitlab" | "glab" => Some("gitlab"),
155156
"github" | "gh" => Some("github"),
157+
"model-runner" | "model_runner" => Some("model-runner"),
156158
"outlook" => Some("outlook"),
157159
_ => None,
158160
}

crates/openshell-providers/src/profiles.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const BUILT_IN_PROFILE_YAMLS: &[&str] = &[
2121
include_str!("../../../providers/copilot.yaml"),
2222
include_str!("../../../providers/github.yaml"),
2323
include_str!("../../../providers/gitlab.yaml"),
24+
include_str!("../../../providers/model-runner.yaml"),
2425
include_str!("../../../providers/nvidia.yaml"),
2526
include_str!("../../../providers/openai.yaml"),
2627
include_str!("../../../providers/opencode.yaml"),

crates/openshell-providers/src/providers/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub mod copilot;
88
pub mod generic;
99
pub mod github;
1010
pub mod gitlab;
11+
pub mod model_runner;
1112
pub mod nvidia;
1213
pub mod openai;
1314
pub mod opencode;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
use crate::{DiscoveredProvider, ProviderError, ProviderPlugin};
5+
6+
pub struct ModelRunnerProvider;
7+
8+
impl ProviderPlugin for ModelRunnerProvider {
9+
fn id(&self) -> &'static str {
10+
"model-runner"
11+
}
12+
13+
fn discover_existing(&self) -> Result<Option<DiscoveredProvider>, ProviderError> {
14+
Ok(Some(DiscoveredProvider::default()))
15+
}
16+
}
17+
18+
#[cfg(test)]
19+
mod tests {
20+
use super::ModelRunnerProvider;
21+
use crate::ProviderPlugin;
22+
23+
#[test]
24+
fn model_runner_provider_id_is_correct() {
25+
assert_eq!(ModelRunnerProvider.id(), "model-runner");
26+
}
27+
28+
#[test]
29+
fn model_runner_discover_returns_default_provider() {
30+
let result = ModelRunnerProvider
31+
.discover_existing()
32+
.expect("discovery should succeed");
33+
assert!(result.is_some());
34+
}
35+
}

providers/model-runner.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
id: model-runner
5+
display_name: Docker Model Runner
6+
description: Local AI inference via Docker Model Runner
7+
category: inference
8+
inference_capable: true
9+
endpoints:
10+
- host: model-runner.docker.internal
11+
port: 80
12+
protocol: rest
13+
access: read-write
14+
enforcement: enforce
15+
binaries: [/usr/local/bin/docker]

0 commit comments

Comments
 (0)