Repository navigation
feat: add AbliteratedLLM provider to OpenAI-compatible registry - #506
whiteworthy wants to merge 7 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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.
|
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 Shared boundary (all compatible chat and completion models).
Leading whitespace needs no special handling because the JSON parser skips it. Bodies that carry 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 Making the long-request path reachable (253bf82, separate commit). By default the error above could never arrive. Every non-streaming exchange is bounded by Tests (deterministic transport, no key, no cassette):
Commands run on 253bf82 (rustc 1.100.0 stable, Linux):
I did not make any live API call. |
eric8810
left a comment
There was a problem hiding this comment.
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.
|
Disclosure: I run AbliteratedLLM. Thanks for the re-review. I've done both follow-ups:
Commands run on d212c30 (rustc stable, Linux):
I didn't make any live API call. |
eric8810
left a comment
There was a problem hiding this comment.
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.
|
Disclosure: I run AbliteratedLLM. I merged
One follow-up commit (278658f): master's new On the merged branch: |
eric8810
left a comment
There was a problem hiding this comment.
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 后再合。
|
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 |
|
Thanks for the review. CI did run for the current head (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.
|
Disclosure: I operate AbliteratedLLM. Merged current Run on the merged tree (WSL, Linux): |
|
master 现在是 0.7.0(#546 已合并,v0.7.0 已发布),你的分支落后 13 个 commit。冲突文件: rebase 后 CI 绿我就合。之前 review 的内容我已 approve。 |
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.
aimux-providers/src/provider_registry.json: nameabliteratedllm, displayAbliteratedLLM, base URLhttps://api.abliteratedllm.dev/v1, key variableABLITERATEDLLM_API_KEY. Its profile setsin_band_retryable_codes: ["upstream_error"]andresponse_timeout_secs: 630(see below). The file is sorted byname, so the row goes betweenabacusandabliteration_ai.200and whitespace, so a later failure can only arrive as a top-levelerrorobject in that body (errors docs).openai_compatible/error.rsgainsjson_response_handler<T>, which non-streaming chat and completion now use. A body with anerrorand nochoicesbecomes theApiCallerror a failed status would give: the provider's message and code, the observed status 200, and a redacteddata. It is retryable only when its code is in the row's newprofile.in_band_retryable_codes. Ordinary responses go through the existing parser unchanged.profile.response_timeout_secssetsChatSettings::response_timeouton non-streaming requests, following the Replicate precedent. Without it the 30 s exchange default drops the connection before the 90 s point. Theabliteratedllmrow sets 630 s: the documented 10-minute limit plus 30 s. Streaming stays exempt, and every other row keeps the default.response_body(follow-up from review). The in-band error now goes through the existing 64 KiB public error-body cap. A newaimux_provider_utils::public_error_bodywraps the privateerror_body_string, so the in-band path is capped the same way as failed-status errors.invalid_response_api_calluses the same helper.docs/contributing/adding-a-provider.mddocuments the two new profile settings.docs/api/providers.mdis regenerated withpython scripts/gen_providers_doc.py, not edited by hand.aimux-providers/tests/presets_test.rschange from 282 to 283.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
Checklist
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassescargo test --workspacepasses (cassette playback — no network/keys)README.md,docs/,rfc/,bindings/README.md)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_resultandabliteratedllm_waits_for_the_documented_time_limit.error_structure_and_base_url/error_with_a_success_statustests, includingan_oversize_error_sent_with_a_success_status_has_a_capped_body.a_response_timeout_bounds_the_exchange.preset.rsprofile-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:
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.docs/PROJECT-OVERVIEW.md.CHANGELOG.md,rfc/anddocs/internal/.No live testing. I did not send a live request with a real API key.
Protocol evidence (RFC-0006, section 4)
https://api.abliteratedllm.dev/v1Authorization: Bearer <key>(x-api-keyis also accepted). Keys are created at https://abliteratedllm.dev/dashboard/keys.POST /v1/chat/completions, using the OpenAI request and response shape:tools,tool_choiceandparallel_tool_calls, fortype: "function"tools only.GET /v1/modelsis public and needs no key. On 2026-11-14 it listed 15 models.{"error":{"type":"authentication_error","code":"invalid_api_key","message":"Missing or invalid API key."}}.glm-5.3-flash-abliterated.max_tokens_key: the endpoint accepts bothmax_tokensandmax_completion_tokens.200followed 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)cargo test -p aimux-providers --test presets_test: 14 passed, including the count asserts (283) and the name-order checkcargo test -p aimux-providers --lib: 4573 passedcargo test -p aimux-provider-utils: all passedcargo clippy -p aimux-provider-utils -p aimux-providers --all-targets -- -D warnings: cleanRUSTDOCFLAGS="-D warnings" cargo doc -p aimux-provider-utils --no-deps: cleancargo fmt --all -- --checkcargo test -p aimux-providers --test openai_compatible_test(625 passed)bash scripts/check_provider_boundaries.sh:provider boundaries: okmaster(c5a4083) when opened; feat: add Cheaper Inference provider to OpenAI-compatible registry #501 is still open, so whichever merges second needs its counts bumped