Skip to content

feat: add AbliteratedLLM provider to OpenAI-compatible registry - #506

Open
whiteworthy wants to merge 7 commits into
arcships:masterfrom
whiteworthy:add-abliteratedllm
Open

whiteworthy wants to merge 7 commits into
arcships:masterfrom
whiteworthy:add-abliteratedllm

Conversation

@whiteworthy

@whiteworthy whiteworthy commented Nov 14, 2026 •

Copy link
Copy Markdown

Disclosure: I run AbliteratedLLM.

Summary

This PR adds AbliteratedLLM as an OpenAI-compatible registry preset. AbliteratedLLM is a pay-per-token API for abliterated (refusal-removed) and stock open-weight models. The registry row follows the same pattern as #22 (InferenceHub) and #501 (Cheaper Inference). Review turned up one documented protocol difference, so the PR also makes a small change to the shared compatible layer and adds two profile settings.

  • One row in aimux-providers/src/provider_registry.json: name abliteratedllm, display AbliteratedLLM, base URL https://api.abliteratedllm.dev/v1, key variable ABLITERATEDLLM_API_KEY. Its profile sets in_band_retryable_codes: ["upstream_error"] and response_timeout_secs: 630 (see below). The file is sorted by name, so the row goes between abacus and abliteration_ai.
  • Errors returned with HTTP 200 (9abb6ea). After 90 s, AbliteratedLLM starts a non-streaming response with 200 and whitespace, so a later failure can only arrive as a top-level error object in that body (errors docs). openai_compatible/error.rs gains json_response_handler<T>, which non-streaming chat and completion now use. A body with an error and no choices becomes the ApiCall error a failed status would give: the provider's message and code, the observed status 200, and a redacted data. It is retryable only when its code is in the row's new profile.in_band_retryable_codes. Ordinary responses go through the existing parser unchanged.
  • Long non-streaming exchanges (253bf82). The new profile.response_timeout_secs sets ChatSettings::response_timeout on non-streaming requests, following the Replicate precedent. Without it the 30 s exchange default drops the connection before the 90 s point. The abliteratedllm row sets 630 s: the documented 10-minute limit plus 30 s. Streaming stays exempt, and every other row keeps the default.
  • Capped response_body (follow-up from review). The in-band error now goes through the existing 64 KiB public error-body cap. A new aimux_provider_utils::public_error_body wraps the private error_body_string, so the in-band path is capped the same way as failed-status errors. invalid_response_api_call uses the same helper.
  • docs/contributing/adding-a-provider.md documents the two new profile settings.
  • docs/api/providers.md is regenerated with python scripts/gen_providers_doc.py, not edited by hand.
  • The two registry-count asserts in aimux-providers/tests/presets_test.rs change from 282 to 283.
  • The hand-written counts change from 327/282 to 328/283, to match the generated page. These are the places listed in the feat: add Cheaper Inference provider to OpenAI-compatible registry #501 review:
    • README.md: tagline (line 7), providers-… badge (line 16), "Why aimux" (line 39), and Rust by-name creation (line 327);
    • docs/API.md:99;
    • docs/PROJECT-OVERVIEW.md: lines 3, 16, 27, 219, 265, 293, 461;
    • docs/api/rust.md:74;
    • docs/provider-config-manual.md:182.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change
  • New provider
  • New / updated binding
  • Docs / RFC

Checklist

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (cassette playback — no network/keys)
  • Added or updated cassette tests / contract fixtures for behavior changes
  • Updated relevant docs (README.md, docs/, rfc/, bindings/README.md)
  • Commit messages follow Conventional Commits

Notes for reviewers

  • No new cassette. The new behaviour is covered by deterministic transport tests that need no key:

    • presets_test.rs: abliteratedllm_reports_an_error_sent_after_a_200, abliteratedllm_reads_a_200_result and abliteratedllm_waits_for_the_documented_time_limit.
    • Chat and completion error_structure_and_base_url/error_with_a_success_status tests, including an_oversize_error_sent_with_a_success_status_has_a_capped_body.
    • a_response_timeout_bounds_the_exchange.
    • The preset.rs profile-parsing tests.

    The row is also covered by every_registry_row_loads_and_creates_without_environment.

  • Overlap with feat: add Cheaper Inference provider to OpenAI-compatible registry #501. feat: add Cheaper Inference provider to OpenAI-compatible registry #501 is still open and changes the same counts. If it merges first, I will rebase and move these numbers to 284/329.

  • Left unchanged:

    • The "327 providers" text in the binding package descriptions (bindings/node/package.json, bindings/flutter/pubspec.yaml, bindings/flutter/ios/aimux.podspec). These last changed in the 0.6.0 release commit. I can bump them here if you prefer.
    • The "aimux 14.5x" ratio in docs/PROJECT-OVERVIEW.md.
    • CHANGELOG.md, rfc/ and docs/internal/.
  • No live testing. I did not send a live request with a real API key.

Protocol evidence (RFC-0006, section 4)
  • Docs: https://abliteratedllm.dev/docs (machine index: https://abliteratedllm.dev/llms.txt)
  • Base URL: https://api.abliteratedllm.dev/v1
  • Auth: Authorization: Bearer <key> (x-api-key is also accepted). Keys are created at https://abliteratedllm.dev/dashboard/keys.
  • Chat: POST /v1/chat/completions, using the OpenAI request and response shape:
    • SSE streaming, with usage in the final chunk;
    • tools, tool_choice and parallel_tool_calls, for type: "function" tools only.
  • Models: GET /v1/models is public and needs no key. On 2026-11-14 it listed 15 models.
  • A keyless request returns HTTP 401 with {"error":{"type":"authentication_error","code":"invalid_api_key","message":"Missing or invalid API key."}}.
  • Model id for test configuration: glm-5.3-flash-abliterated.
  • No max_tokens_key: the endpoint accepts both max_tokens and max_completion_tokens.
  • Long requests: a non-streaming response not ready within 90 s is sent as 200 followed by whitespace, and a later failure arrives as {"error": {..., "code": "upstream_error"}}, which the docs say to retry with backoff. The request time limit is 10 minutes.

Verification

  • python3 scripts/gen_providers_doc.py --check: up to date (registry=283, total=328)
  • On d212c30 (rustc stable, Linux):
    • cargo test -p aimux-providers --test presets_test: 14 passed, including the count asserts (283) and the name-order check
    • cargo test -p aimux-providers --lib: 4573 passed
    • cargo test -p aimux-provider-utils: all passed
    • cargo clippy -p aimux-provider-utils -p aimux-providers --all-targets -- -D warnings: clean
    • RUSTDOCFLAGS="-D warnings" cargo doc -p aimux-provider-utils --no-deps: clean
  • cargo fmt --all -- --check
  • On 253bf82: cargo test -p aimux-providers --test openai_compatible_test (625 passed)
  • bash scripts/check_provider_boundaries.sh: provider boundaries: ok
  • Based on current master (c5a4083) when opened; feat: add Cheaper Inference provider to OpenAI-compatible registry #501 is still open, so whichever merges second needs its counts bumped

Registry entry (name abliteratedllm, base_url
https://api.abliteratedllm.dev/v1, env ABLITERATEDLLM_API_KEY, default
profile) + regenerated docs/api/providers.md (gen_providers_doc.py).
Bumps the two registry-count asserts in presets_test.rs from 282 to 283
and the hand-written counts (327/282 -> 328/283) in README.md,
docs/API.md, docs/PROJECT-OVERVIEW.md, docs/api/rust.md and
docs/provider-config-manual.md.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The registry shape, sorted insertion, generated catalogue and 283/328 counts are consistent with the current base. Reusing the shared compatible layer is the right architecture, but there is one documented protocol difference to handle.

P2: preserve errors returned inside HTTP 200 for long non-streaming requests. The official errors documentation says that after 90 seconds the service starts a 200 response with whitespace; a later timeout/backend failure is returned as a top-level error object. The new row selects the default compatible do_generate path, which deserializes ChatCompletionResponse and returns InvalidResponseData("Response did not contain any choices.") at chat/chat_language_model.rs:515–517. The wire type ignores error and defaults choices to empty. Consequently upstream_error loses its actual message/code and becomes non-retryable. I reproduced the wire-type behavior in an isolated Rust harness using the unchanged production type and an error-body fixture.

Please handle this documented success-status error envelope in a reusable shared response boundary or an appropriately scoped adapter, preserving the upstream failure and suitable retry classification. Add a deterministic transport fixture for HTTP 200 plus whitespace plus error, alongside an ordinary successful response. No live key or derived cassette is needed. The all-row test only constructs providers; it does not exercise this behavior.

Cloud validation: cargo +1.98.1 fmt --all -- --check, provider-document generator check, and provider-boundary check passed; the isolated production wire-type probe passed. Full presets test build was not complete, so I do not claim it passed. CI run 43571684918 is action_required, not green. No live API call or Mac test was performed. #501 is still separate; whichever merges second must reconcile counts.

A server that starts a long non-streaming response early (status 200,
then whitespace to keep the connection open) can only report a later
failure as a top-level `error` object in that body. The compatible chat
and completion models read such a body as a result without choices and
failed with InvalidResponseData, losing the message, the code and any
retry classification.

Non-streaming chat and completion now use a shared successful-response
handler (`openai_compatible::error::json_response_handler`). A JSON body
with a non-null top-level `error` and no `choices` becomes the ApiCall
error a failed status would give: message and code from the provider's
error structure, the observed status, the raw body, origin HttpResponse.
Other bodies take the unchanged create_json_response_handler path.

Such an error has no failed status to judge by, so it is retryable only
for codes a row lists in the new `profile.in_band_retryable_codes`. The
abliteratedllm row lists `upstream_error`, which its errors documentation
says arrives in a 200 body after 90 seconds and should be retried with
backoff.

Tests: 200 + whitespace + error and ordinary 200 results on the
abliteratedllm row (presets_test), plus the shared boundary for chat and
completion and the profile key parse.
@whiteworthy

whiteworthy commented Nov 14, 2026 •

Copy link
Copy Markdown
Author

Disclosure: I run AbliteratedLLM.

Thanks for the careful review. You were right: a long non-streaming request that fails after the 200 has gone out was coming back as InvalidResponseData("Response did not contain any choices."), so the message, the code and the retry hint were all lost. Fixed in 9abb6ea (fix(compatible): surface error envelopes returned with HTTP 200).

Shared boundary (all compatible chat and completion models). openai_compatible/error.rs gains json_response_handler<T>, and CompatModelConfig::json_response_handler wires it up next to failed_response_handler. Non-streaming chat (chat_language_model.rs) and completion (completion_language_model.rs) now use it in place of the bare create_json_response_handler. The success path is unchanged: the handler delegates to create_json_response_handler::<T>(), so parsing, size caps and error messages stay the same. After that it checks one case. If the JSON body has a non-null top-level error and no (or empty) choices, the handler returns the ApiCall a failed status would give:

  • message and provider_code come from the provider's own error_structure, the same mapping the non-2xx path uses.
  • status_code is the observed 200 and origin is HttpResponse.
  • The body is kept in response_body and in redacted form in data.

Leading whitespace needs no special handling because the JSON parser skips it. Bodies that carry choices are not touched. Before this change, every such body already failed as InvalidResponseData for every preset, so no successful response changes behavior.

Retry classification (scoped, data-only). A 200 body has no failed status to judge by. I kept the shared default non-retryable, which matches how the compatible layer treats in-stream error codes. A row can now list the codes its vendor documents as worth retrying in that position, with the new profile.in_band_retryable_codes (preset.rs → ChatSettings::in_band_retryable_codes, documented in docs/contributing/adding-a-provider.md). The abliteratedllm row lists only upstream_error. The errors page says a failure after the 200 (time limit, no output, backend failure, restart) arrives as that code and should be retried with backoff. No Retry-After header can be sent at that point, so Core's exponential backoff applies. No code branches on the provider name.

Making the long-request path reachable (253bf82, separate commit). By default the error above could never arrive. Every non-streaming exchange is bounded by EXCHANGE_RESPONSE_TIMEOUT (30 s, post_to_api.rs), and the compatible http_request never overrides it. AbliteratedLLM only starts its 200 plus whitespace at 90 s, so aimux would have dropped the connection at 30 s and retried. The docs bill such a disconnect for the estimated input. Following the Replicate precedent (request.response_timeout = Some(...)), a row can now declare profile.response_timeout_secs: ChatSettings::response_timeout is set on the request in CompatModelConfig::http_request, and streaming stays exempt as before. The abliteratedllm row sets 630 s, which is the documented 10-minute limit plus 30 s for the upload and the error body. Every other row keeps the 30 s default. If you'd rather keep per-row timeouts out of the registry, I can drop this commit and say in the docs that long non-streaming requests to this provider need streaming instead.

Tests (deterministic transport, no key, no cassette):

  • aimux-providers/tests/presets_test.rs:
    • abliteratedllm_reports_an_error_sent_after_a_200: HTTP 200 with "\n\n\n" followed by the error object. upstream_error becomes ApiCall with status 200, its code and message, and is_retryable == true. A code the row does not list (invalid_request) keeps its message and is not retryable.
    • abliteratedllm_reads_a_200_result: an ordinary 200 result, and the same result after leading whitespace, both read as text ok from https://api.abliteratedllm.dev/v1/chat/completions.
  • openai_compatible/tests/chat/chat_language_model.rs (error_structure_and_base_url):
    • an_error_sent_with_a_success_status_keeps_its_message_and_code: generic provider, not retryable.
    • a_listed_code_makes_an_error_sent_with_a_success_status_retryable
  • openai_compatible/tests/completion/completion_language_model.rs: error_with_a_success_status::keeps_its_message_and_code
  • preset.rs: an_in_band_retryable_code_list_is_read, a_response_timeout_is_read, a_response_timeout_is_positive
  • chat_language_model.rs: a_response_timeout_bounds_the_exchange (a 50 ms bound against a 500 ms response gives the exchange-timeout error, so the setting reaches the exchange)
  • presets_test.rs: abliteratedllm_waits_for_the_documented_time_limit (630 s on the row; openrouter keeps the default)
  • The existing should_reject_a_response_without_choices (choices [] with no error) still gives InvalidResponseData.

Commands run on 253bf82 (rustc 1.100.0 stable, Linux):

  • cargo fmt --all -- --check: clean
  • cargo clippy -p aimux-providers --all-targets -- -D warnings: clean
  • cargo test -p aimux-providers: all passed, 0 failures (lib 4572 passed, including the timeout and in-band-code tests; presets_test 14/14, including abliteratedllm_waits_for_the_documented_time_limit, abliteratedllm_reports_an_error_sent_after_a_200 and abliteratedllm_reads_a_200_result; openai_compatible_test 625/625)
  • python scripts/gen_providers_doc.py --check (Python 3.13): up to date (registry=283, non-registry=45, total=328)
  • bash scripts/check_provider_boundaries.sh: provider boundaries: ok

I did not make any live API call.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed 253bf82 against the previous request for changes. The blocking HTTP-200 error case is addressed: the shared chat/completion response boundary preserves the provider message/code and observed status, with retryability enabled only by the declared in-band code list. Ordinary responses still use the existing parser. The additional per-row non-streaming exchange timeout is justified by the documented long-response protocol; other presets keep the existing default and the transport still exempts streaming.

Independent cloud validation: presets_test 14/14 passed (including whitespace plus HTTP-200 error, unlisted code, and normal result); openai_compatible_test 625/625 passed; stable cargo fmt, generated provider documentation and provider-boundary checks passed. No live API request or Mac test was run. I did not independently run the entire crate/lib test suite or Clippy. CI run 43577102525 remains action_required, so this approval does not imply CI is green.

Non-blocking follow-up: consider reusing the existing bounded public-error-body formatting for response_body instead of raw.to_string(), so the new in-band path has the same 64-KiB serialized error-context cap as failed-status errors. Also update the PR description: it still says empty profile/no protocol differences even though the final patch intentionally adds two profile settings and transport regression tests. Counts are correct on the current base; reconcile them if #501 lands first.

Reuse the 64 KiB public error-body cap for the in-band error path through a new aimux_provider_utils::public_error_body, which invalid_response_api_call now uses too.
@whiteworthy

Copy link
Copy Markdown
Author

Disclosure: I run AbliteratedLLM.

Thanks for the re-review. I've done both follow-ups:

  • Capped response_body. aimux-provider-utils now has a public public_error_body(&Value) -> String. It wraps the existing private error_body_string, so the 64 KiB cap is applied after lossy decoding and the …(truncated) marker stays the same. The in-band path in openai_compatible/error.rs uses it in place of raw.to_string(). I also switched invalid_response_api_call to it, so there's only one way to do this. A new test, an_oversize_error_sent_with_a_success_status_has_a_capped_body, sends a ~100 KiB in-band error and checks that the message and code are kept, the body ends with the marker, and it stays within the cap.
  • PR description. It now describes the two profile settings, the shared-layer change and the transport tests, rather than an empty profile.

Commands run on d212c30 (rustc stable, Linux):

  • cargo test -p aimux-providers --lib: 4573 passed, including the new test
  • cargo test -p aimux-providers --test presets_test: 14 passed
  • cargo test -p aimux-provider-utils: all passed
  • cargo clippy -p aimux-provider-utils -p aimux-providers --all-targets -- -D warnings: clean
  • RUSTDOCFLAGS="-D warnings" cargo doc -p aimux-provider-utils --no-deps: clean
  • cargo fmt --all -- --check: clean

I didn't make any live API call.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-reviewed d212c30's incremental change after the previous approval. The follow-up correctly reuses the existing UTF-8-safe 64-KiB public error-body cap for the HTTP-200 error envelope, and invalid_response_api_call now delegates to the same helper without changing its behavior. Provider message/code extraction, retry classification, redacted data and successful responses are unchanged. The oversized transport regression asserts the bounded body and preserved message/code. The PR description now reflects the actual protocol work. No new blocking issue found.

Independent cloud validation on this head: 4 isolated tests using the unchanged production cap/helper passed (ordinary JSON, oversized ASCII, multibyte UTF-8, exact/over-cap boundary); cargo +stable fmt --all -- --check, generated provider-document check and provider-boundary check passed. I did not independently rerun the full provider-utils/provider transport suites or Clippy on this head, so the prior 14/625 results are not claimed as current-head results. No live API call or Mac test was run. CI run 43585826216 is still action_required, not green.

Conflicts:
- aimux-provider-utils/src/lib.rs: re-export both upstream's
  create_json_bytes_response_handler and public_error_body.
- docs/contributing/adding-a-provider.md: keep upstream's list of
  optional fields and add profile.in_band_retryable_codes and
  profile.response_timeout_secs to it.
…keys

sync_registry.py mirrors the registry row validation of preset/mod.rs and
refused the abliteratedllm row's profile.in_band_retryable_codes and
profile.response_timeout_secs. Validate them as preset/mod.rs does: a
string list, and a positive whole number of seconds.
@whiteworthy

Copy link
Copy Markdown
Author

Disclosure: I run AbliteratedLLM.

I merged master into the branch to clear the conflicts (5e13d10), with no change to the provider itself:

  • aimux-provider-utils/src/lib.rs: the re-export list keeps both master's create_json_bytes_response_handler and this PR's public_error_body
  • docs/contributing/adding-a-provider.md: kept master's bullet list and added profile.in_band_retryable_codes and profile.response_timeout_secs to it
  • preset.rs moved to preset/mod.rs on master; the descriptor fields, profile parsing and the three unit tests came across with it

One follow-up commit (278658f): master's new scripts/sync_registry.py checks profile keys against its own allow-list, which didn't have the two profile keys this PR adds. That would have failed test_repo_offline_check_passes_and_is_deterministic, so both keys are now allowed there, with the same checks as the Rust side.

On the merged branch: cargo fmt --all -- --check is clean, presets_test 14 passed, the preset unit tests 20 passed, the openai_compatible tests 324 passed, and scripts.tests.test_sync_registry plus test_probe_registry 22 passed.

@eric8810 eric8810 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Registry row/ENV/base URL、200+error 的 in-band 映射、64 KiB 截断、retryable code 和 630s 非流式 timeout 都核对通过;本地 presets/gen_docs/sync_registry 测试通过。Approve。但该分支当前没有任何 GitHub checks(statusCheckRollup 为空),需 push 重新触发 CI 后再合。

@whiteworthy

Copy link
Copy Markdown
Author

Disclosure: I operate AbliteratedLLM.

Thanks for the re-review, @eric8810. CI did trigger on the last push: run 44544956889 for head 278658f is waiting at action_required, which GitHub shows for a first-time contributor until a maintainer clicks Approve and run workflows. A new push would stop at the same gate. The branch is level with master (0 commits behind), so approving that run should be enough.

@whiteworthy

Copy link
Copy Markdown
Author

Thanks for the review. CI did run for the current head 278658fa: https://github.com/arcships/aimux/actions/runs/44544956889. It is waiting at action_required because this is my first contribution to the repo, so GitHub holds the workflow until a maintainer clicks "Approve and run workflows". Waiting runs do not appear in the checks list. Another push would be held the same way, so I have not pushed again. If you would still like a new commit to start CI, tell me and I will push one.

(CI 已为当前 head 触发,但因首次贡献需要维护者在上面的链接中点击 "Approve and run workflows" 才会运行。)

Resolve the provider-utils re-export list (keep upstream's new handlers and parse_sse_json alongside public_error_body), regenerate docs/api/providers.md with scripts/gen_providers_doc.py (registry=283, non-registry=47, total=330), and quote those totals in README, docs/API.md and docs/PROJECT-OVERVIEW.md.
@whiteworthy

Copy link
Copy Markdown
Author

Disclosure: I operate AbliteratedLLM.

Merged current master (178885a) into this branch as c5012d0, no rebase, so your approved commits are unchanged. The conflicts were the response_handler re-export list in aimux-provider-utils/src/lib.rs (kept the new upstream exports plus public_error_body) and the provider counts. The counts now follow gen_providers_doc.py --check: 330 = 283 registry rows + 47 non-registry packages. The 47 also counts the new minimax module, which the README hadn't picked up yet. Say if you'd rather I leave that line to its own change.

Run on the merged tree (WSL, Linux): cargo fmt --check; aimux-provider-utils tests; openai_compatible 338; preset 20; presets_test 14; conformance_test 50; clippy -D warnings clean; test_sync_registry.py, test_probe_registry.py, sync_registry.py --check, gen_providers_doc.py --check and check_provider_boundaries.sh all pass. The GitHub workflows will still need Approve and run workflows for this push.

@eric8810

Copy link
Copy Markdown
Contributor

master 现在是 0.7.0(#546 已合并,v0.7.0 已发布),你的分支落后 13 个 commit。冲突文件:README.md、docs/API.md、docs/PROJECT-OVERVIEW.md(master 的 provider 数已经是 329 = 282 presets + 47 vendor,你加 abliteratedllm 后应该是 330 / 283 / 47,请用 python3 scripts/gen_providers_doc.py --check 核对生成的数字)、aimux-providers/src/openai_compatible/provider.rs 和 aimux-provider-utils/src/lib.rs(与 #545 合入的 language_model_with_api 改动撞了,两边都要保留)。

rebase 后 CI 绿我就合。之前 review 的内容我已 approve。

This branch has not been deployed

No deployments
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.

2 participants