docs(aimlapi): document aimlapi.com as an LLM/embedding provider - #1
Open
Lookoff-AIMLAPI wants to merge 2 commits into
Open
docs(aimlapi): document aimlapi.com as an LLM/embedding provider#1Lookoff-AIMLAPI wants to merge 2 commits into
Lookoff-AIMLAPI wants to merge 2 commits into
Conversation
cognee dispatches every completion through litellm, and litellm has shipped a first-class `aiml` provider (AIMLChatConfig, base https://api.aimlapi.com/v1) since well before the version this repo pins. So aimlapi.com already works with zero adapter code -- it was simply undiscoverable, because nothing in the repo said so. This adds the same three surfaces the OpenRouter route already has (.env.template block, CLAUDE.md snippet, integrations skill bullet), a runnable example, and the Integrations Hub card. Two facts here are not guessable and are the reason a user gives up: - `LLM_PROVIDER` must be "custom". An "aiml/" model prefix on its own raises ProviderNotDeducibleError, because cognee's provider enum is deliberately small -- the same reason OpenRouter needs "custom". - Embeddings must NOT carry the "aiml/" prefix. litellm registers no embedding route for `aiml`, so "aiml/openai/text-embedding-3-large" fails with "Unmapped LLM provider for this endpoint". The unprefixed id plus EMBEDDING_ENDPOINT pointed at aimlapi.com works, and that is what the example uses. The example uses EMBEDDING_MAX_COMPLETION_TOKENS rather than the EMBEDDING_MAX_TOKENS spelling most of test_llms.yml uses: EmbeddingConfig declares `embedding_max_completion_tokens`, and nothing reads `embedding_max_tokens`, so the shorter spelling is silently absorbed by `extra="allow"` and has no effect. Verified against the live API: the example runs end to end (remember + recall) with both the LLM and the embeddings served by aimlapi.com, and every model id named here was called through cognee's own GenericAPIAdapter, not asserted from the catalogue.
Moves the aimlapi.com entry to the top of the three hand-ordered provider lists (.env.template TIER 4, CLAUDE.md's LLM Provider Configuration, and the cognee-integrations skill bullet list) and adds it first to CLAUDE.md's "Supported providers" sentence. Placement only — no content change. Kept separate so it can be dropped before an upstream PR, where provider order is the maintainers' call. Two lists are deliberately untouched because their order is machine-decided, not editorial: catalog entries are sorted by kind then id in catalog/loader.py, and the test_llms.yml jobs are an unordered GitHub Actions mapping that runs in parallel.
Lookoff-AIMLAPI
force-pushed
the
docs/aimlapi-provider
branch
from
September 3, 2026 08:22
d601d54 to
896ad10
Compare
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.
Description
cognee already works on aimlapi.com today — nothing in the codebase had to change
for that. Every completion goes through litellm, and litellm has shipped a
first-class
aimlprovider (AIMLChatConfig, basehttps://api.aimlapi.com/v1)since long before the
litellm>=1.83.7pin here. What was missing was any hintthat this is possible:
grep -i aimlapiover the tree returns nothing, so a userhas no way to discover the route.
So this is a documentation PR, and it lands on the same surfaces the OpenRouter
route already occupies, plus the Integrations Hub card and a runnable example
that the catalog guide asks every new integration to point at.
I started out expecting to add a provider and stopped when the live calls showed
there was nothing to add. Two things did turn up that are worth writing down,
because both are silent failures a user cannot reason their way out of:
1.
LLM_PROVIDERmust be"custom". Setting onlyLLM_MODEL="aiml/..."raises
ProviderNotDeducibleError— cognee's provider enum is deliberatelysmall and
aimlis not in it. This is the same situation OpenRouter is in, andthe error message does point at
custom, but it fires at import time from apydantic validator, which is a confusing place to meet it.
2. Embeddings must NOT carry the
aiml/prefix. litellm registers noembedding route for
aiml, only chat and image generation. Soaiml/openai/text-embedding-3-largedies withlitellm.BadRequestError: Unmapped LLM provider for this endpoint. The working shape is the unprefixed model idplus
EMBEDDING_ENDPOINTaimed at aimlapi.com, which routes through litellm'sOpenAI-compatible handler. That asymmetry between
LLM_MODELandEMBEDDING_MODELis the single least guessable thing here, so it is called outin all four places.
A separate thing I hit on the way:
EMBEDDING_MAX_TOKENSis a no-op. Thesettings field is
embedding_max_completion_tokens, nothing anywhere readsembedding_max_tokens, andEmbeddingConfighasextra="allow"so the wrongspelling is absorbed without complaint. Eight existing jobs in
test_llms.ymluse the wrong spelling. I did not touch them — out of scope for this PR — but
the example here uses the spelling that actually works, which
.env.templatealready uses in its advanced section.
Acceptance Criteria
Every model id named in these docs was called for real, through cognee's own
GenericAPIAdapter, not asserted from the catalogue.acreate_structured_outputreturned a parsed pydantic model for each:
aiml/openai/gpt-4o-miniAnswer(capital='Paris', country='France')aiml/openai/gpt-5-miniAnswer(capital='Paris', country='France')aiml/deepseek/deepseek-v4-flashAnswer(capital='Paris', country='France')aiml/google/gemini-2.5-flashAnswer(capital='Paris', country='France')aiml/anthropic/claude-sonnet-4.6Answer(capital='Paris', country='France')Tool calling works on all four families through the same route
(
get_weather{"city":"Paris"}). One id that the aimlapi.com catalogue publishesas a chat model,
meta-llama/llama-3.3-70b-versatile, 404s on a real call — itis deliberately not named anywhere here.
The new example runs end to end, LLM and embeddings both on aimlapi.com,
no OpenAI key involved:
That the embedding call really reaches aimlapi.com and not api.openai.com is
confirmed by swapping in a bogus key: the 401 body comes back from aimlapi.com's
own billing page, so
EMBEDDING_ENDPOINTis genuinely honoured.Catalog validation:
Tests. Baseline on a pristine
main:11 failed, 4670 passed, 69 skippedfor
cognee/tests/unit. After this branch,cognee/tests/unit+catalog/tests:11 failed, 4680 passed, 69 skipped— the same 11 failures, name for name (diffed),plus the 10 catalog tests the after-run added. The 11 are pre-existing and unrelated
(retrieval / code-graph). Three files fail to collect on both trees for missing
optional deps (
eval_framework×2,neo4j_deadlock_test) and were excluded fromboth runs.
cognee/tests/unit/infrastructure/llmpasses clean.ruff checkandruff format --checkpass on the new example.Type of Change
Notes for review
The last commit,
chore(aimlapi): fork-only placement — do not send upstream, isplacement only — it moves the entry to the top of the three hand-ordered provider
lists. It is kept separate so it can be dropped cleanly; provider ordering is a
maintainer decision, not a contributor one. The catalog's own ordering machinery
(sorted by kind then id in
catalog/loader.py) and thetest_llms.ymljobmapping are untouched, because neither order is editorial.
Not included, and why: a
test-aimlapijob for.github/workflows/test_llms.yml,mirroring
test-openrouterone-for-one, was written and then left out — thecredential this branch was pushed with has no
workflowscope, so GitHub refusesany push that touches a workflow file. It is a ~28-line job and should be added
in a follow-up by someone who can push workflows; it also needs a repo secret,
AIMLAPI_API_KEY, provisioned by a maintainer, the same wayOPENROUTER_API_KEYis for the job it would sit beside.
One more note added after the first push: litellm's own env var for this provider
is
AIML_API_KEY, and cognee never reads it — it passesapi_keyto litellmexplicitly, so a user who sets only
AIML_API_KEY(following litellm's docs) getsLLMAPIKeyNotSetError. Verified, and called out in.env.templateandCLAUDE.md.