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
10 changes: 7 additions & 3 deletions docs/api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
Based on the resource OpenAPI document from `../platform` at `f20ded3`, plus its dashboard
auth integrations. The `query` filter on `GET /v1/sandboxes` and the `name` and `status`
filters on `GET /v1/images` come from platform `2396647`. `GET /v1/sandboxes/{id}/usage`
comes from platform `d3b6c77`.
Every resource operation has a named command. `adapt api METHOD PATH`
also exposes same-origin JSON requests for less common account operations.
comes from platform `d3b6c77`. The model routes come from platform `8747699`.
Every resource operation has a named command, except model provider writes (`POST`, `PUT`,
and `DELETE` on `/v1/model-gateway/providers`); configure providers in the Platform dashboard.
`adapt api METHOD PATH` also exposes same-origin JSON requests for less common account operations.

`{id}` denotes the corresponding resource ID. Writes requiring an idempotency key receive
one from the CLI, or reuse the UUID supplied with `--idempotency-key`.
Expand Down Expand Up @@ -60,6 +61,9 @@ one from the CLI, or reuse the UUID supplied with `--idempotency-key`.
| `GET /v1/environment-variable-sets/{id}` | `env get ID` |
| `PUT /v1/environment-variable-sets/{id}` | `env update ID --data JSON` |
| `DELETE /v1/environment-variable-sets/{id}` | `env delete ID` |
| `GET /v1/models` | `models list` |
| `GET /v1/model-gateway/providers` | `models providers` |
| `GET /v1/model-gateway/providers/{id}/models` | `models discover ID` |
| `POST /v1/gateway/connections` | `connections create --data JSON` |
| `GET /v1/gateway/connections` | `connections list` |
| `GET /v1/gateway/connections/{id}` | `connections get ID` |
Expand Down
32 changes: 32 additions & 0 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Replace example names such as `SANDBOX_ID` and `EXEC_ID` with your resource IDs.
- [Files](#files)
- [Hosted applications](#hosted-applications)
- [Images and environment variables](#images-and-environment-variables)
- [Models](#models)
- [Resource IDs](#resource-ids)
- [JSON requests](#json-requests)
- [Lists and filters](#lists-and-filters)
Expand Down Expand Up @@ -42,6 +43,7 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`.
| `env` | `list`, `get`, `create`, `update`, `delete` |
| `registry` | `list`, `create`, `update`, `delete` |
| `connections` | `list`, `get`, `create`, `update`, `delete`, `refresh`, `grant`, `oauth`, `oauth-complete`, `calls`, `principals`, `search`, `describe`, `call` |
| `models` | `list`, `providers`, `discover` |
| `keys` | `list`, `create`, `delete` |
| `sessions` | `list`, `revoke`, `revoke-others` |
| `mcp` | `list`, `revoke`, `tools` |
Expand Down Expand Up @@ -390,6 +392,35 @@ Create a sandbox with the image and variable set:
adapt sandbox create --image-id IMAGE_ID --variable-set VARIABLE_SET_ID --wait
```

## Models

List the models enabled in your organization:

```sh
adapt models list
```

Model IDs include the provider prefix, such as `openai/gpt-5`.
This command requires the `modelGateway` `use` permission.
Owners and admins have it; an API key has it only if its permissions grant it.

List the configured model providers:

```sh
adapt models providers
```

The output never includes provider API keys.
To configure providers, use the Platform dashboard.

To list every model that a provider offers, including disabled models, run:

```sh
adapt models discover PROVIDER_ID
```

`discover` requires a browser login as an organization owner or admin.

## Resource IDs

These resources accept full UUIDs or unique ID prefixes:
Expand All @@ -398,6 +429,7 @@ These resources accept full UUIDs or unique ID prefixes:
- Images and registry credentials.
- Volumes and endpoints.
- Environment variable sets and tool connections.
- Model providers.

This also applies to references such as `--image-id`, `--credential`, and both IDs in an endpoint binding.

Expand Down
13 changes: 13 additions & 0 deletions skills/adapt/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,19 @@ describe the message-posting tool and use that channel ID. Listing channels is
a separate action from sending a message. Inspect tool results for reported
errors as well as the CLI exit status.

## Models

```sh
adapt models list --json
adapt models providers --json
```

`models list` returns the organization's enabled models; IDs include the
provider prefix, such as `openai/gpt-5`. It needs `modelGateway` `use`
permission, which an API key has only if granted. `models providers` lists configured
providers without their keys. `models discover PROVIDER_ID` lists every model a
provider offers and requires browser sign-in as an owner or admin.

## Platform MCP server

```sh
Expand Down
18 changes: 18 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ pub enum Command {
/// Manage upstream MCP connections and call tools
#[command(subcommand)]
Connections(ConnectionCommand),
/// Inspect model providers and the enabled model catalog
#[command(subcommand, visible_alias = "model")]
Models(ModelCommand),
/// Manage organization API keys
#[command(subcommand)]
Keys(KeyCommand),
Expand Down Expand Up @@ -725,6 +728,21 @@ pub enum SessionCommand {
RevokeOthers,
}

#[derive(Subcommand)]
pub enum ModelCommand {
/// List the organization's enabled models, as provider/model IDs
#[command(visible_alias = "ls")]
List,
/// List configured model providers (API keys are never returned)
Providers,
/// List every model a provider offers, including disabled models
#[command(after_help = "Requires browser sign-in as an organization owner or admin.")]
Discover {
/// Full provider UUID or an unambiguous ID prefix
id: ResourceRef,
},
}

#[derive(Subcommand)]
pub enum McpCommand {
/// List MCP clients you have authorized
Expand Down
5 changes: 5 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ pub async fn run(cli: Cli) -> Result<u8> {
RegistryCommand::Delete { id } => delete(&api, &format!("/v1/registry-credentials/{id}")).await?,
},
Command::Connections(command) => connections(&api, command).await?,
Command::Models(command) => match command {
ModelCommand::List => api.get("/v1/models").await?,
ModelCommand::Providers => api.get("/v1/model-gateway/providers").await?,
ModelCommand::Discover { id } => api.get(&format!("/v1/model-gateway/providers/{id}/models")).await?,
},
Command::Keys(command) => keys(&api, command).await?,
Command::Sessions(command) => match command {
SessionCommand::List => api.get("/v1/auth/sessions").await?,
Expand Down
1 change: 1 addition & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use support::*;
mod endpoint_request;
mod image_list;
mod mcp_tools;
mod models;
mod resource_prefixes;
mod retries;
mod sandbox_list;
Expand Down
67 changes: 67 additions & 0 deletions tests/models/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
use crate::support::*;
use serde_json::json;

#[test]
fn model_commands_request_their_paths_and_pass_json_through() {
let catalog = json!({"object":"list","data":[
{"id":"openai/gpt-5","object":"model","created":1762800000,"owned_by":"openai"}
]});
let providers = json!({"providers":[{
"id":ID,"provider":"openai","name":"OpenAI","disabledModels":["gpt-4o"],"enabled":true,
"version":2,"createdAt":"2026-11-11T00:00:00Z","updatedAt":"2026-11-12T00:00:00Z"
}],"adaptProviders":["anthropic"]});
let discovered = json!({"version":2,"models":[
{"id":"gpt-5","name":"GPT-5"},{"id":"gpt-4o","name":"GPT-4o"}
]});
let server = Server::start(vec![
step("GET", "/v1/models".into(), None, catalog.clone()),
step(
"GET",
"/v1/model-gateway/providers".into(),
None,
providers.clone(),
),
step(
"GET",
"/v1/model-gateway/providers/11111111/models".into(),
None,
discovered.clone(),
),
]);
let dir = tempfile::tempdir().unwrap();
assert_eq!(
success(&run(dir.path(), &server.url, &["models", "list"])),
catalog
);
assert_eq!(
success(&run(dir.path(), &server.url, &["models", "providers"])),
providers
);
assert_eq!(
success(&run(
dir.path(),
&server.url,
&["models", "discover", "11111111"]
)),
discovered
);
server.finish();
}

#[test]
fn discover_reports_the_api_error() {
let server = Server::start(vec![Box::new(|_| {
Reply::json(
403,
json!({"error":{"code":"FORBIDDEN","message":"Sign in as an owner or admin to manage provider keys."}}),
)
})]);
let dir = tempfile::tempdir().unwrap();
let output = run(dir.path(), &server.url, &["models", "discover", ID]);
assert!(!output.status.success());
assert!(
String::from_utf8_lossy(&output.stderr)
.contains("403 FORBIDDEN: Sign in as an owner or admin to manage provider keys.")
);
server.finish();
}
Loading