Skip to content

fix: add modelReferences to endpoint create/update and document in runpod.toml template#281

Open
jebenexer wants to merge 2 commits into
mainfrom
ben/sls-94-modelname-cli
Open

fix: add modelReferences to endpoint create/update and document in runpod.toml template#281
jebenexer wants to merge 2 commits into
mainfrom
ben/sls-94-modelname-cli

Conversation

@jebenexer

@jebenexer jebenexer commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds support for modelReferences in the endpoint create/update flow.

Changes

  1. api/endpoint.go — Added ModelReferences []string field to CreateEndpointInput; fixed missing json:"id" tag on Endpoint.Id; added modelReferences to GetEndpoints GraphQL query; added UpdateEndpointModel() function that uses saveEndpoint mutation to update models on existing endpoints

  2. cmd/project/functions.godeployProject reads model_refs from endpoint config and passes it as ModelReferences to CreateEndpointInput

  3. cmd/project/tomlBuilder.go — Documents the new model_refs config key in the [endpoint] section of the runpod.toml template

  4. cmd/endpoint/update_model.go (new) — Adds runpodctl endpoint model <endpoint-id> <model-ref> [model-ref...] CLI command to set model references on an existing endpoint

  5. cmd/root.go — Registers the new endpoint command group

Related

@promptless

promptless Bot commented May 26, 2026

Copy link
Copy Markdown

Promptless prepared a documentation update related to this change.

Triggered by PR #281

This documents the new runpodctl endpoint model command for setting model references on serverless endpoints. Added a new reference page for endpoint commands and updated the CLI overview.

Review: Document runpodctl endpoint model command

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds modelReferences support to serverless endpoint creation and introduces a new CLI command to update an existing endpoint’s cached model references, with accompanying documentation in the runpod.toml template.

Changes:

  • Extend endpoint API payloads/queries to include modelReferences, and fix JSON unmarshalling for endpoint IDs.
  • Read model_refs from runpod.toml during project deploy and pass through to endpoint creation.
  • Add runpodctl endpoint model ... command for updating model references on an existing endpoint.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/root.go Registers the new top-level endpoint command group.
cmd/project/tomlBuilder.go Documents model_refs in the generated runpod.toml template.
cmd/project/functions.go Parses model_refs from TOML and passes them into endpoint creation.
cmd/endpoint/update_model.go Adds CLI subcommand to set endpoint model references.
cmd/endpoint/endpoint.go Introduces the endpoint command group and wires subcommands.
api/endpoint.go Adds ModelReferences to create input, fixes Endpoint.Id JSON tag, extends queries, and adds model update mutation helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/project/functions.go
Comment on lines +601 to +605
if refs, ok := endpointConfig.Get("model_refs").([]interface{}); ok {
for _, r := range refs {
modelRefs = append(modelRefs, r.(string))
}
}
Comment on lines +10 to +21
var modelCmd = &cobra.Command{
Use: "model <endpoint-id> <model-ref> [model-ref...]",
Short: "update model references on an endpoint",
Long: "set the model references (cached models) for a serverless endpoint",
Args: cobra.MinimumNArgs(2),
RunE: runModel,
}

func runModel(cmd *cobra.Command, args []string) error {
endpointID := args[0]
modelRefs := args[1:]

- Use checked type assertion for model_refs TOML array elements in
  functions.go to avoid panic on non-string values
- Add --clear flag to 'endpoint model' command to allow removing all
  model references from an endpoint without providing a dummy value

@TimPietruskyRunPod TimPietruskyRunPod left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the modelReferences plumbing here is solid — CreateEndpointInput, the GetEndpoints query addition, UpdateEndpointModel() via saveEndpoint, and the runpod.toml model_refs key are all the right pieces. requesting changes on the CLI surface only.

don't introduce a new top-level endpoint group — use the existing serverless group.

we already have serverless (create/delete/get/list/update), and serverless create --model-reference already landed in #276. adding endpoint model alongside it gives two command namespaces for the same resource, and model would be the only thing under endpoint — so the surface fragments and --model-reference (create) vs endpoint model (update) becomes inconsistent for the same concept.

endpoint model <id> [refs...] [--clear] is functionally just a serverless update that only touches model refs. fold it into the command that already exists:

  • set/replace: runpodctl serverless update <id> --model-reference a --model-reference b
  • remove all: runpodctl serverless update <id> --clear-models

concretely:

  • add a repeatable --model-reference (StringArrayVar) and a --clear-models bool to cmd/serverless/update.go, matching the --model-reference verb already on serverless create
  • on update, set modelReferences on the saveEndpoint input: the provided refs, or [] when --clear-models is passed (same empty-list-to-clear behavior the current --clear already relies on)
  • keep all the api / runpod.toml plumbing from this PR as-is — only the command placement changes
  • drop cmd/endpoint/ (and revert the docs to extend the serverless reference page instead of a new endpoint page)

the only thing that would justify a new group is a deliberate rename serverlessendpoint (the API/console domain term is "Endpoint") with serverless kept as a hidden alias — but that's a bigger decision and should be its own PR with a deprecation plan, not introduced as a side effect of adding model refs.

tl;dr: plumbing 👍 — move endpoint modelserverless update --model-reference / --clear-models and drop the new top-level group.

@TimPietruskyRunPod

Copy link
Copy Markdown
Member

to be clear on scope — the read-side additions are great, keep them:

  • adding modelReferences to the GetEndpoints() query selection so cached models surface in serverless get / serverless list 👍
  • the Endpoint.ModelReferences field + the endpoint-id json unmarshalling fix 👍
  • model_refs in runpod.toml + the project-deploy passthrough 👍

the only change requested is the write-side command placement: drop the new top-level endpoint group (cmd/endpoint/) and expose the update via serverless update --model-reference / --clear-models instead. everything else in the PR stays.

so: read extension to serverless get = 🔥, just not the endpoint model command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants