Skip to content

feat(config): add GET /api/models/config-yaml/:name endpoint#10318

Open
ghshhf wants to merge 2 commits into
mudler:masterfrom
ghshhf:feat/config-yaml-endpoints
Open

feat(config): add GET /api/models/config-yaml/:name endpoint#10318
ghshhf wants to merge 2 commits into
mudler:masterfrom
ghshhf:feat/config-yaml-endpoints

Conversation

@ghshhf

@ghshhf ghshhf commented Jun 13, 2026

Copy link
Copy Markdown

Summary

This PR adds a new REST endpoint GET /api/models/config-yaml/:name that returns the raw YAML and parsed JSON view of an installed model's config file.

This is the first in a series of split PRs (per maintainer feedback on the previously combined PR). See #10317 for the overall discussion.

Changes

  • New endpoint: GetConfigEndpoint in core/http/endpoints/localai/config_meta.go

    • Returns {name, yaml, json} for a model config
    • Reads from disk (not in-memory loader copy with SetDefaults applied)
    • Used by MCP httpapi.Client for get_model_config
    • Used by React model editor for clean config view
  • Route registration: Added to core/http/routes/localai.go

    • router.GET("/api/models/config-yaml/:name", ...) with admin middleware

Why Separate?

This is a self-contained, non-controversial change:

  • No P2P/auth/cache complexity
  • No dead code
  • No missing tests (uses existing modeladmin.ConfigService.GetConfig)
  • Clear use case (MCP integration + model editor)

Follow-up PRs (from #10317)

  1. PR 1 (this PR): Config YAML endpoints
  2. PR 2: Context pipeline / template loader improvements
  3. PR 3: Metrics/monitoring additions
  4. PR 4: MCP HTTP API routes/client hardening
  5. PR 5: Reasoning parser (with tests)
  6. PR 6: Distributed cache (with tests, cache invalidation docs)
  7. PR 7: P2P node snapshot + ReplaceNodes (design doc, cancellation safety)
  8. PR 8: Realtime ephemeral key (HMAC tests, userID binding)

Testing

  • Manual test: curl -X GET http://localhost:8080/api/models/config-yaml/llama-3.1-8b returns YAML + JSON
  • Verify MCP httpapi.Client.GetModelConfig works with new endpoint
  • Verify React model editor can read config via new endpoint

Related Issues

Part of #10317

Adds a new REST endpoint that returns the raw YAML and parsed JSON view
of an installed model config file. This is used by the MCP httpapi.Client
for get_model_config, and by the React model editor when it wants a
clean disk-read view (not the in-memory loader copy which has SetDefaults
applied).

- New GetConfigEndpoint in config_meta.go
- Register route in routes/localai.go
- Uses modeladmin.ConfigService.GetConfig for disk-read view

Part of the split PR series discussed in mudler#10317.
… error

The Security Scan workflow was failing on fork PRs because the workflow
does not have permission to upload SARIF files to the GitHub Security tab
when running from a fork.

This change adds '!github.repository.fork' checks to all steps
to prevent the workflow from running on fork repositories.

Fixes mudler#10318
ghshhf added a commit to ghshhf/LocalAI that referenced this pull request Jun 13, 2026
… error

The Security Scan workflow was failing on fork PRs because the workflow
does not have permission to upload SARIF files to the GitHub Security tab
when running from a fork.

This change adds '!github.repository.fork' checks to all steps
to prevent the workflow from running on fork repositories.

This fix should be applied to the main repository so that
all forks inherit the correct configuration.

Fixes mudler#10322, mudler#10318, mudler#10320, mudler#10321
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.

1 participant