Skip to content

feat: backend omlx - #167

Merged
thushan merged 5 commits into
mainfrom
feature/backend-omlx
Jun 8, 2026
Merged

thushan merged 5 commits into
mainfrom
feature/backend-omlx

Conversation

@thushan

@thushan thushan commented Jun 7, 2026 •

Copy link
Copy Markdown
Owner

Adds native support for oMLX backend.

Summary by CodeRabbit

  • New Features

    • Added oMLX local AI runtime backend support with native Anthropic Messages API passthrough
    • OpenAI‑compatible backends now surface maximum context length information
  • Documentation

    • Comprehensive oMLX docs and API reference added, including setup, examples (streaming/chat/embeddings), headers, and troubleshooting guidance

@thushan thushan self-assigned this Jun 7, 2026
@thushan thushan added the llm-backend Issue is about an LLM Backend, provider or type. (Eg. Ollama, vllm) label Jun 7, 2026
@coderabbitai

coderabbitai Bot commented Jun 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b021d97f-c46b-45f4-8957-74fd8657bd3e

📥 Commits

Reviewing files that changed from the base of the PR and between 8a0e82b and bd0c81e.

📒 Files selected for processing (6)
  • docs/content/api-reference/omlx.md
  • docs/content/index.md
  • docs/content/integrations/api-translation/anthropic.md
  • docs/content/integrations/backend/omlx.md
  • internal/adapter/registry/profile/openai_compatible_parser_test.go
  • internal/adapter/registry/profile/parsers.go
✅ Files skipped from review due to trivial changes (3)
  • docs/content/index.md
  • docs/content/api-reference/omlx.md
  • docs/content/integrations/backend/omlx.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/content/integrations/api-translation/anthropic.md
  • internal/adapter/registry/profile/openai_compatible_parser_test.go
  • internal/adapter/registry/profile/parsers.go

Walkthrough

Adds oMLX as a supported backend: provider constants and profile, routing and discovery registration, OpenAI-compatible model parsing updates with tests, and extensive API and integration documentation.

Changes

oMLX Backend Integration

Layer / File(s) Summary
Provider constants and profile definitions
internal/core/constants/providers.go, internal/core/constants/providers_test.go, internal/core/domain/profile.go, internal/version/version.go
Introduces ProviderTypeOMLX, ProviderDisplayOMLX, and ProviderPrefixOMLX constants, defines ProfileOMLX, adds omlx to SupportedBackends, and validates constants via tests.
oMLX profile configuration
config/profiles/omlx.yaml
Comprehensive oMLX profile defining OpenAI compatibility mode, native Anthropic Messages passthrough, routed endpoints (health, models, models/status, chat/completions, completions, embeddings, rerank, messages, responses), request/response parsing rules, streaming support, model capability patterns, Apple Silicon resource defaults, concurrency/timeouts, and response metrics extraction.
Model metadata parsing and tests
internal/adapter/registry/profile/openai_compatible.go, internal/adapter/registry/profile/parsers.go, internal/adapter/registry/profile/openai_compatible_parser_test.go
Adds optional max_model_len field to OpenAI-compatible model struct, updates parser to include MaxModelLen in details gating and map it to domain.ModelDetails.MaxContextLength when >0, and adds tests covering presence/absence/zero/invalid cases and mapping of owned_by.
Routing, discovery and handler registration
internal/adapter/discovery/http_client.go, internal/app/handlers/handler_common.go, internal/app/handlers/handler_common_test.go, internal/app/handlers/handler_provider_common.go, internal/app/handlers/handler_provider_compatibility_test.go, internal/app/handlers/server_routes.go
Registers oMLX in auto-discovery order (Apple Silicon), adds fallback support in handler logic, registers static provider routes for models and proxying, and extends compatibility tests for oMLX.
oMLX API reference
docs/content/api-reference/omlx.md, docs/content/api-reference/overview.md
Adds API reference for /olla/omlx/* (health, models, models/status, chat/completions with streaming, completions, embeddings, rerank, responses), sampling params, examples, and header forwarding/response header docs; updates API overview to list oMLX.
Integration and conceptual documentation
docs/content/integrations/backend/omlx.md, docs/content/concepts/profile-system.md, docs/content/configuration/reference.md, docs/content/integrations/api-translation/anthropic.md, docs/content/integrations/frontend/claude-code.md, docs/content/integrations/overview.md, docs/content/faq.md, docs/content/getting-started/quickstart.md, docs/content/index.md, docs/content/usage.md, docs/mkdocs.yml
Adds oMLX integration guide, operational details, startup/customisation/troubleshooting guidance, updates concept pages, FAQ, quickstart, index, usage docs, Anthropic compatibility table, and MkDocs navigation entries.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • thushan/olla#33: Introduced the provider-scoped routing/profile framework that this PR extends with oMLX registration.
  • thushan/olla#105: Related to Anthropic passthrough support and profile metadata consumed by Anthropic translation infrastructure.
  • thushan/olla#109: Also extends SupportedBackends with another backend identifier and modifies related plumbing.

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: backend omlx' accurately describes the main change, which is adding native support for the oMLX backend across configuration, documentation, and codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/backend-omlx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thushan

thushan commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

@sg-shag / @bongiozzo let me know if this profile works for you natively.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/content/api-reference/omlx.md`:
- Around line 170-180: The fenced streaming example block is missing a language
tag which causes markdown lint errors; update the fenced code block that starts
with the streaming lines like `data: {"id":"chatcmpl-abc123",...}` and ends with
`data: [DONE]` to include a language identifier (e.g., add ```text before the
first data line and keep the closing ```), so the block becomes a labeled "text"
code fence for proper linting and rendering.

In `@docs/content/index.md`:
- Line 104: The backend-type examples list for the header `X-Olla-Backend-Type`
is missing the `docker-model-runner` provider; update the table cell value that
currently lists
"(ollama/openai/openai-compatible/lm-studio/llamacpp/vllm/sglang/lemonade/lmdeploy/omlx)"
to include `docker-model-runner` among the comma-separated backend types so the
supported providers are consistent across docs.

In `@docs/content/integrations/api-translation/anthropic.md`:
- Line 62: The docs list oMLX as compatible in the integrations text but the
"Passthrough-Compatible Backends" table omits it; update the
Passthrough-Compatible Backends table to include oMLX so the table matches the
inline list (ensure the table row/entry for oMLX reflects its passthrough
eligibility given native Anthropic support and follows the same naming/format
used for other backends in that table).

In `@docs/content/integrations/backend/omlx.md`:
- Around line 205-207: The documentation line for the endpoint
<code>/v1/messages/count_tokens</code> incorrectly claims a “forwarded path”;
update the wording to reflect that oMLX does not forward token-count requests
(see the profile flag <code>token_count: false</code>)—e.g., replace “Anthropic
token count (forwarded path; see note above)” with a phrase that states it is
not forwarded / not supported for passthrough (and reference the profile
setting) so the docs no longer imply passthrough behavior.

In `@internal/adapter/registry/profile/parsers.go`:
- Around line 232-246: The hasDetails check currently considers model.OwnedBy
but no value is set from it, causing empty domain.ModelDetails; update the
construction of details in the parsing path (the hasDetails branch) to map
model.OwnedBy into details.Publisher (or remove OwnedBy from the hasDetails
condition). Specifically, when model.OwnedBy != nil set details.Publisher =
model.OwnedBy (converting types if necessary) alongside the existing assignments
for ModifiedAt and MaxContextLength so that domain.ModelDetails actually
contains the publisher information.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 69695952-f318-4419-a755-f04081b75954

📥 Commits

Reviewing files that changed from the base of the PR and between a9ce40e and 8a0e82b.

📒 Files selected for processing (27)
  • config/profiles/omlx.yaml
  • docs/content/api-reference/omlx.md
  • docs/content/api-reference/overview.md
  • docs/content/concepts/profile-system.md
  • docs/content/configuration/reference.md
  • docs/content/faq.md
  • docs/content/getting-started/quickstart.md
  • docs/content/index.md
  • docs/content/integrations/api-translation/anthropic.md
  • docs/content/integrations/backend/omlx.md
  • docs/content/integrations/frontend/claude-code.md
  • docs/content/integrations/overview.md
  • docs/content/usage.md
  • docs/mkdocs.yml
  • internal/adapter/discovery/http_client.go
  • internal/adapter/registry/profile/openai_compatible.go
  • internal/adapter/registry/profile/openai_compatible_parser_test.go
  • internal/adapter/registry/profile/parsers.go
  • internal/app/handlers/handler_common.go
  • internal/app/handlers/handler_common_test.go
  • internal/app/handlers/handler_provider_common.go
  • internal/app/handlers/handler_provider_compatibility_test.go
  • internal/app/handlers/server_routes.go
  • internal/core/constants/providers.go
  • internal/core/constants/providers_test.go
  • internal/core/domain/profile.go
  • internal/version/version.go

Comment thread docs/content/api-reference/omlx.md Resolved
Comment thread docs/content/index.md Resolved
Comment on lines +205 to +207
<td><code>/v1/messages/count_tokens</code></td>
<td>Anthropic token count (forwarded path; see note above)</td>
</tr>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix contradiction on /v1/messages/count_tokens forwarding behaviour.

This row says “forwarded path”, but earlier docs and profile config state Olla does not forward token-count requests for oMLX yet (token_count: false). Please reword to avoid implying passthrough support.

Suggested fix
-    <td>Anthropic token count (forwarded path; see note above)</td>
+    <td>Anthropic token count endpoint exists on oMLX, but Olla currently serves local estimation (not forwarded)</td>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/content/integrations/backend/omlx.md` around lines 205 - 207, The
documentation line for the endpoint <code>/v1/messages/count_tokens</code>
incorrectly claims a “forwarded path”; update the wording to reflect that oMLX
does not forward token-count requests (see the profile flag <code>token_count:
false</code>)—e.g., replace “Anthropic token count (forwarded path; see note
above)” with a phrase that states it is not forwarded / not supported for
passthrough (and reference the profile setting) so the docs no longer imply
passthrough behavior.

@bongiozzo

Copy link
Copy Markdown

@sg-shag / @bongiozzo let me know if this profile works for you natively.

It works!

Thank you

shared-goals/thunder-forge@cb6f52e

@thushan
thushan merged commit c903396 into main Jun 8, 2026
7 checks passed
@thushan
thushan deleted the feature/backend-omlx branch June 8, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-backend Issue is about an LLM Backend, provider or type. (Eg. Ollama, vllm)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants