-
Notifications
You must be signed in to change notification settings - Fork 1
docs: add Eden AI integration guide for any-llm (Mozilla AI) #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MVS-source
wants to merge
1
commit into
main
Choose a base branch
from
integrations/any-llm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| --- | ||
| title: "any-llm" | ||
| icon: "/integration-logo/any-llm-icondoc.svg" | ||
| description: "Use any-llm (Mozilla AI) with Eden AI to call 500+ AI models through one unified Python interface." | ||
| --- | ||
|
|
||
| import { TechArticleSchema } from "/snippets/TechArticleSchema.mdx"; | ||
|
|
||
| <TechArticleSchema | ||
| title={"any-llm"} | ||
| description={"Use any-llm (Mozilla AI) with Eden AI to call 500+ AI models through one unified Python interface."} | ||
| path="v3/integrations/any-llm" | ||
| articleSection="AI Frameworks" | ||
| about={"LLM Framework Integration"} | ||
| proficiencyLevel="Intermediate" | ||
| keywords={["Eden AI", "AI API", "any-llm", "Mozilla AI", "Python"]} | ||
| datePublished="2026-07-20T00:00:00Z" | ||
| dateModified="2026-07-20T00:00:00Z" | ||
| /> | ||
|
|
||
| Use any-llm (Mozilla AI) with Eden AI to call 500+ AI models through one unified Python interface. | ||
|
|
||
| ## Overview | ||
|
|
||
| [any-llm](https://github.com/mozilla-ai/any-llm) is a lightweight Python library from **Mozilla AI** that lets you talk to any LLM provider through a single `completion()` interface — swap providers by changing one string. **Eden AI is a built-in any-llm provider**, so you reach models from OpenAI, Anthropic, Google, Mistral and 500+ more behind one key, with EU-based, GDPR-aligned inference. | ||
|
|
||
| You select a model with the `provider:model_id` syntax. For Eden AI, the provider is `edenai` and the model id follows Eden AI's `provider/model` scheme — for example `edenai:anthropic/claude-sonnet-5`. | ||
|
|
||
| ## Installation | ||
|
|
||
| Install any-llm with the Eden AI provider extra: | ||
|
|
||
| <CodeGroup> | ||
| ```bash pip | ||
| pip install 'any-llm-sdk[edenai]' | ||
| ``` | ||
|
|
||
| ```bash uv | ||
| uv add 'any-llm-sdk[edenai]' | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| ## Quick Start | ||
|
|
||
| Set your key, then point any-llm at Eden AI by prefixing any model with `edenai:`: | ||
|
|
||
| <CodeGroup> | ||
| ```bash .env | ||
| EDENAI_API_KEY=your_api_key_here | ||
| ``` | ||
|
|
||
| {/* skip-test */} | ||
| ```python Python | ||
| from any_llm import completion | ||
|
|
||
| response = completion( | ||
| model="edenai:anthropic/claude-sonnet-5", # edenai:<provider>/<model> | ||
| messages=[{"role": "user", "content": "Hello! How are you?"}], | ||
| ) | ||
|
|
||
| print(response.choices[0].message.content) | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| The `edenai` provider automatically uses the Eden AI base URL (`https://api.edenai.run/v3`) and reads your key from the `EDENAI_API_KEY` environment variable. | ||
|
|
||
| ## Switching models | ||
|
|
||
| any-llm's core benefit: change providers by changing one string. Every Eden AI model is reachable the same way: | ||
|
|
||
| <CodeGroup> | ||
| {/* skip-test */} | ||
| ```python Python | ||
| from any_llm import completion | ||
|
|
||
| messages = [{"role": "user", "content": "Write a haiku about the sea."}] | ||
|
|
||
| for model in [ | ||
| "edenai:openai/gpt-5.5", | ||
| "edenai:anthropic/claude-sonnet-5", | ||
| "edenai:mistral/mistral-large-2512", | ||
| ]: | ||
| response = completion(model=model, messages=messages) | ||
| print(model, "->", response.choices[0].message.content) | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| ## Streaming | ||
|
|
||
| Eden AI supports streaming through any-llm — pass `stream=True`: | ||
|
|
||
| <CodeGroup> | ||
| {/* skip-test */} | ||
| ```python Python | ||
| from any_llm import completion | ||
|
|
||
| stream = completion( | ||
| model="edenai:mistral/mistral-small-2603", | ||
| messages=[{"role": "user", "content": "Count from one to five."}], | ||
| stream=True, | ||
| ) | ||
|
|
||
| for chunk in stream: | ||
| delta = chunk.choices[0].delta.content | ||
| if delta: | ||
| print(delta, end="", flush=True) | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| ## Available Models | ||
|
|
||
| Use the `edenai:<provider>/<model>` format for any Eden AI model: | ||
|
|
||
| **OpenAI** | ||
| - `edenai:openai/gpt-5.5` | ||
| - `edenai:openai/gpt-5-mini` | ||
|
|
||
| **Anthropic** | ||
| - `edenai:anthropic/claude-sonnet-5` | ||
| - `edenai:anthropic/claude-opus-4-8` | ||
| - `edenai:anthropic/claude-haiku-4-5` | ||
|
|
||
| **Google** | ||
| - `edenai:google/gemini-2.5-pro` | ||
| - `edenai:google/gemini-3.5-flash` | ||
|
|
||
| **Mistral** | ||
| - `edenai:mistral/mistral-large-2512` | ||
| - `edenai:mistral/mistral-small-2603` | ||
|
|
||
| ## Embeddings | ||
|
|
||
| The Eden AI provider also supports embeddings: | ||
|
|
||
| <CodeGroup> | ||
| {/* skip-test */} | ||
| ```python Python | ||
| from any_llm import embedding | ||
|
|
||
| response = embedding( | ||
| model="edenai:openai/text-embedding-3-small", | ||
| inputs="The quick brown fox jumps over the lazy dog.", | ||
| ) | ||
|
|
||
| print(response.data[0].embedding[:5]) | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| <CodeGroup> | ||
| ```bash .env | ||
| EDENAI_API_KEY=your_api_key_here | ||
| # Optional — override the endpoint: | ||
| EDENAI_API_BASE=https://api.edenai.run/v3 | ||
| ``` | ||
| </CodeGroup> | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Chat Completions](/v3/llms/chat-completions) - Core LLM endpoint | ||
| - [List LLM Models](/v3/llms/listing-models) - Browse available providers and models | ||
| - [aisuite](/v3/integrations/aisuite) - Another unified LLM interface | ||
| - [OpenAI SDK (Python)](/v3/integrations/openai-sdk-python) - Direct SDK usage | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Use standardized token placeholders.
As per coding guidelines, token types in code examples should be distinguished using
api_tokenfor production andsandbox_api_tokenfor testing (no real provider calls), rather than generic placeholders likeyour_api_key_here.v3/integrations/any-llm.mdx#L49-L49: Replaceyour_api_key_herewithapi_token(orsandbox_api_token).v3/integrations/any-llm.mdx#L153-L153: Replaceyour_api_key_herewithapi_token(orsandbox_api_token).📍 Affects 1 file
v3/integrations/any-llm.mdx#L49-L49(this comment)v3/integrations/any-llm.mdx#L153-L153🤖 Prompt for AI Agents
Source: Coding guidelines