feat(llm): add aimlapi.com as an LLM endpoint with partner attribution - #444
Open
hugoaimlapi wants to merge 13 commits into
Open
feat(llm): add aimlapi.com as an LLM endpoint with partner attribution#444hugoaimlapi wants to merge 13 commits into
hugoaimlapi wants to merge 13 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! I'm Hugo from aimlapi.com — an AI aggregator that gives access to 1000+ models in one API, trusted by 400k+ users.
We'd love to be available as a supported provider option inside EverOS — so we went ahead and did all the technical work on our side.
To build our partnership, we offer a 50/50 revenue share on all traffic from this integration. (P.S.: tracking starts as soon as this release goes live, so no earnings will be lost during setup)
My contacts: hugo@aimlapi.com (email / Slack), Telegram: @hug0the
Summary
Why. EverOS reaches every model through the same OpenAI-protocol clients, so an aimlapi.com key already works today by setting
base_urlalone. What doesn't work is attribution: aimlapi.com credits the project that sent the traffic only when the request carries partner headers, and a missing header fails silently — the call succeeds, the credit is simply lost. The docs also read as if OpenRouter were a dependency rather than one choice of OpenAI-protocol endpoint.What changed.
src/everos/component/utils/attribution.py(new): origin-scoped helpers.aimlapi_headers()/aimlapi_request_extra()return the partner headers (X-AIMLAPI-Partner-ID,X-AIMLAPI-Source,HTTP-Referer,X-Title) only when the parsed hostname ofbase_urlisaimlapi.comor a subdomain of it (dot-boundary match, so a lookalike host likeapi.aimlapi.com.example.netcollects nothing), and an empty mapping for every other host — as a fresh dict each call.src/everos/component/llm/client.py: the LLM and multimodal clients pass the headers through everalgo'sLLMConfig.extraasextra_headers; the attribution mapping merges under[llm].extra, so a user-configured key wins on collision. For every non-aimlapi endpoint no request key is added at all.src/everos/component/llm/openai_provider.py:default_headerson theAsyncOpenAIclient whenbase_urlis an aimlapi.com host — this also covers the decider client, which is built onOpenAIProvider.src/everos/component/embedding/openai_provider.py: samedefault_headerswiring.docs/configuration.md: a "Provider endpoints" table under[llm](aimlapi.com / OpenRouter — samevendor/modelslug convention, so the shipped[llm]default works unchanged), plus a recorded known limitation: the image parts EverOS sends carryimage_url.detail = null, which aimlapi.com rejects with HTTP 400, so[multimodal]should stay on a provider that tolerates it. Endpoint comments inconfig.example.toml,src/everos/config/default.toml, and.env.example+src/everos/templates/env.template(regenerated together, per themake docs-checkgate).tests/unit/test_component/test_utils/test_attribution.py(header shape, partner-id pattern, origin scoping incl. lookalike hosts, fresh-dict contract),tests/unit/test_component/test_llm/test_attribution_wiring.py(each client construction site forwards the headers; other providers get no extra request key;[llm].extraoverrides), and one case in the embedding provider tests.Defaults are unchanged:
base_urlstill points at OpenRouter everywhere; aimlapi.com is documented as an alternative. No new dependencies, no env vars touched.Area
Verification
The shipped
[llm]default (openai/gpt-4.1-mini) was called live against aimlapi.com through the component/llm client path, structured-output (response_format) path included.Checklist
main..envfiles, dependency folders, or generated output.Notes for Reviewers
HTTP-Referer/X-Titlename the host project (EverOS), the same convention OpenRouter uses for app attribution.By submitting this pull request, I agree that my contribution is licensed under
the Apache License 2.0.