Skip to content

feat(llm): add aimlapi.com as an LLM endpoint with partner attribution - #444

Open
hugoaimlapi wants to merge 13 commits into
EverMind-AI:mainfrom
aimlapi:feat/llm-aimlapi-attribution
Open

feat(llm): add aimlapi.com as an LLM endpoint with partner attribution#444
hugoaimlapi wants to merge 13 commits into
EverMind-AI:mainfrom
aimlapi:feat/llm-aimlapi-attribution

Conversation

@hugoaimlapi

Copy link
Copy Markdown

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_url alone. 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 of base_url is aimlapi.com or a subdomain of it (dot-boundary match, so a lookalike host like api.aimlapi.com.example.net collects 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's LLMConfig.extra as extra_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_headers on the AsyncOpenAI client when base_url is an aimlapi.com host — this also covers the decider client, which is built on OpenAIProvider.
  • src/everos/component/embedding/openai_provider.py: same default_headers wiring.
  • docs/configuration.md: a "Provider endpoints" table under [llm] (aimlapi.com / OpenRouter — same vendor/model slug convention, so the shipped [llm] default works unchanged), plus a recorded known limitation: the image parts EverOS sends carry image_url.detail = null, which aimlapi.com rejects with HTTP 400, so [multimodal] should stay on a provider that tolerates it. Endpoint comments in config.example.toml, src/everos/config/default.toml, and .env.example + src/everos/templates/env.template (regenerated together, per the make docs-check gate).
  • Tests: 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].extra overrides), and one case in the embedding provider tests.

Defaults are unchanged: base_url still points at OpenRouter everywhere; aimlapi.com is documented as an alternative. No new dependencies, no env vars touched.

Area

  • Architecture method
  • Benchmark
  • Use case
  • Documentation
  • Developer experience
  • CI, build, or release

Verification

uv run pytest tests/unit/test_component/test_utils/test_attribution.py \
  tests/unit/test_component/test_llm/test_attribution_wiring.py \
  tests/unit/test_component/test_embedding/test_openai_provider.py -q

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

  • I kept the change scoped to the relevant area.
  • I am opening this from a separate branch, not pushing directly to main.
  • I updated docs, examples, or setup notes when behavior changed.
  • I added or updated tests when the change affects behavior.
  • I did not commit secrets, .env files, dependency folders, or generated output.
  • Active relative links in Markdown files resolve.

Notes for Reviewers

  • The partner headers can never ride a request to another provider: every helper is origin-scoped, and the tests pin it — including lookalike hosts.
  • HTTP-Referer / X-Title name 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.

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