Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@
"pages": [
"v3/integrations/openai-sdk-python",
"v3/integrations/openai-sdk-typescript",
"v3/integrations/langchain"
"v3/integrations/langchain",
"v3/integrations/pydantic-ai"
]
},
{
Expand Down
3 changes: 3 additions & 0 deletions integration-logo/pydantic-ai-icondoc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 46 additions & 1 deletion v3/integrations/hermes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
proficiencyLevel="Intermediate"
keywords={["Eden AI", "AI API", "Hermes Agent", "Nous Research"]}
datePublished="2026-06-19T00:00:00Z"
dateModified="2026-06-19T00:00:00Z"
dateModified="2026-07-16T00:00:00Z"
/>

Connect [Hermes Agent](https://hermes-agent.nousresearch.com) to Eden AI and run the self-hosted, persistent agent on 500+ models with automatic fallbacks and a single API key.
Expand Down Expand Up @@ -66,7 +66,7 @@
```yaml config.yaml
model:
provider: custom
base_url: https://api.edenai.run/v3

Check warning on line 69 in v3/integrations/hermes.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/hermes.mdx#L69

Did you really mean 'base_url'?
default: anthropic/claude-sonnet-4-5
```
</CodeGroup>
Expand Down Expand Up @@ -111,7 +111,7 @@
| `anthropic/claude-opus-4-8` | Maximum capability |
| `anthropic/claude-haiku-4-5` | Fast and cheap |
| `openai/gpt-5` | OpenAI's frontier model |
| `google/gemini-2.5-pro` | Long context, multimodal |

Check warning on line 114 in v3/integrations/hermes.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/hermes.mdx#L114

Did you really mean 'multimodal'?

Browse the full catalog at [app.edenai.run/models](https://app.edenai.run/models).

Expand All @@ -123,6 +123,51 @@
hermes fallback add
```

## First-class provider plugin (optional)

The setup above uses Hermes' generic `custom` provider, which is the fastest way to get running. For a **native `--provider eden-ai` experience** — so Eden AI shows up in `hermes model`, `hermes doctor`, and the setup wizard — install Eden AI as a **standalone model-provider plugin**. Drop a directory under `$HERMES_HOME/plugins/model-providers/eden-ai/`, with no changes to the Hermes repo:

<CodeGroup>
{/* skip-test */}
```python __init__.py

Copy link
Copy Markdown

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

Verify the rendering of double underscores in the tab name.

If the tab name renders incorrectly as init.py, users might mistakenly name the file init.py, which would break the Python module. Please verify that it renders correctly as __init__.py, and consider escaping the underscores (e.g., \_\_init\_\_.py) if needed. As per coding guidelines, avoid using double underscores (__name__) in code blocks as they may render as bold in some contexts — always verify inside code fences.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v3/integrations/hermes.mdx` at line 132, Verify that the tab name in the
code-fence metadata renders visibly as __init__.py rather than init.py; if the
renderer treats underscores as formatting, escape the underscores while
preserving the intended filename.

Source: Coding guidelines

from providers import register_provider
from providers.base import ProviderProfile

eden_ai = ProviderProfile(
name="eden-ai",
aliases=("edenai",),
display_name="Eden AI",
description="Eden AI — 500+ models via one OpenAI-compatible API (EU/GDPR)",
signup_url="https://app.edenai.run",
env_vars=("EDENAI_API_KEY",),
base_url="https://api.edenai.run/v3",
auth_type="api_key",
default_aux_model="mistral/mistral-small-2603",
fallback_models=(
"anthropic/claude-sonnet-5",
"openai/gpt-5.5",
"mistral/mistral-small-2603",
),
)

register_provider(eden_ai)
```

```yaml plugin.yaml
name: eden-ai
kind: model-provider
version: 1.0.0
description: Eden AI — 500+ models via one OpenAI-compatible API (EU/GDPR)
author: Eden AI
```
</CodeGroup>

Hermes then auto-wires credential resolution, the `--provider eden-ai` flag, the `hermes model` picker (models fetched from `{base_url}/models`), and the `hermes doctor` health check. Select it with:

```bash
hermes chat --provider eden-ai
```

## Troubleshooting

### `401` / `Custom token not found`
Expand Down
205 changes: 205 additions & 0 deletions v3/integrations/pydantic-ai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
---
title: "Pydantic AI"
icon: "/integration-logo/pydantic-ai-icondoc.svg"
description: "Use Pydantic AI with Eden AI to build type-safe agents on 500+ AI models through one API."

Check warning on line 4 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L4

Did you really mean 'Pydantic'?
---

import { TechArticleSchema } from "/snippets/TechArticleSchema.mdx";

<TechArticleSchema
title={"Pydantic AI"}
description={"Use Pydantic AI with Eden AI to build type-safe agents on 500+ AI models through one API."}

Check warning on line 11 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L11

Did you really mean 'Pydantic'?
path="v3/integrations/pydantic-ai"
articleSection="AI Frameworks"
about={"LLM Framework Integration"}
proficiencyLevel="Intermediate"
keywords={["Eden AI", "AI API", "Pydantic AI", "Python", "Agents"]}
datePublished="2026-07-16T00:00:00Z"
dateModified="2026-07-16T00:00:00Z"
/>

Use Pydantic AI with Eden AI to build type-safe agents on 500+ AI models through one API.

## Overview

Pydantic AI is a type-safe, structured-output agent framework for Python. It works with any OpenAI-compatible endpoint through `OpenAIChatModel` + `OpenAIProvider`, so you can point it at Eden AI's V3 API and access models from OpenAI, Anthropic, Google, Cohere, Meta, and more — behind one key, with EU-based, GDPR-aligned inference.

Check warning on line 25 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L25

Did you really mean 'Pydantic'?

## Installation

<CodeGroup>
```bash pip
pip install pydantic-ai
```

```bash poetry
poetry add pydantic-ai
```

</CodeGroup>

## Quick Start

Point Pydantic AI's OpenAI model at Eden AI:

Check warning on line 42 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L42

Did you really mean 'Pydantic'?

<CodeGroup>
{/* skip-test */}
```python Python
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
"openai/gpt-5.5",
provider=OpenAIProvider(
api_key="YOUR_EDEN_AI_API_KEY", # Get from https://app.edenai.run

Copy link
Copy Markdown

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 standard token types in code examples.

The documentation uses placeholders like YOUR_EDEN_AI_API_KEY and your_api_key_here. As per coding guidelines, code examples must distinguish token types by using api_token for production and sandbox_api_token for testing (no real provider calls).

  • v3/integrations/pydantic-ai.mdx#L54-L54: Replace "YOUR_EDEN_AI_API_KEY" with "api_token", and optionally note sandbox_api_token in the adjacent comment.
  • v3/integrations/pydantic-ai.mdx#L106-L106: Replace "YOUR_EDEN_AI_API_KEY" with "api_token".
  • v3/integrations/pydantic-ai.mdx#L131-L131: Replace "YOUR_EDEN_AI_API_KEY" with "api_token".
  • v3/integrations/pydantic-ai.mdx#L162-L162: Replace "YOUR_EDEN_AI_API_KEY" with "api_token".
  • v3/integrations/pydantic-ai.mdx#L182-L182: Replace your_api_key_here with api_token.
📍 Affects 1 file
  • v3/integrations/pydantic-ai.mdx#L54-L54 (this comment)
  • v3/integrations/pydantic-ai.mdx#L106-L106
  • v3/integrations/pydantic-ai.mdx#L131-L131
  • v3/integrations/pydantic-ai.mdx#L162-L162
  • v3/integrations/pydantic-ai.mdx#L182-L182
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v3/integrations/pydantic-ai.mdx` at line 54, The Pydantic AI documentation
uses nonstandard API-key placeholders. In v3/integrations/pydantic-ai.mdx at
lines 54, 106, 131, and 162, replace “YOUR_EDEN_AI_API_KEY” with “api_token”; at
line 54, optionally mention “sandbox_api_token” in the adjacent comment. At line
182, replace “your_api_key_here” with “api_token”.

Source: Coding guidelines

base_url="https://api.edenai.run/v3",
),
)

agent = Agent(model)
result = agent.run_sync("Hello! How are you?")
print(result.output)
```
</CodeGroup>

## Available Models

Access models from multiple providers using the `provider/model` format:

**OpenAI**
- `openai/gpt-5.5`
- `openai/gpt-5-mini`

**Anthropic**
- `anthropic/claude-sonnet-5`
- `anthropic/claude-opus-4-8`
- `anthropic/claude-haiku-4-5`

**Google**
- `google/gemini-2.5-pro`
- `google/gemini-3.5-flash`

**Mistral**
- `mistral/mistral-large-2512`
- `mistral/mistral-small-2603`

## Structured Output

Pydantic AI's signature feature works unchanged — define a Pydantic `output_type` and the agent returns a validated object, whichever Eden AI model you choose:

Check warning on line 88 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L88

Did you really mean 'Pydantic'?

<CodeGroup>
{/* skip-test */}
```python Python
from pydantic import BaseModel

Check warning on line 93 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L93

Did you really mean 'pydantic'?
from pydantic_ai import Agent

Check warning on line 94 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L94

Did you really mean 'pydantic_ai'?
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

class City(BaseModel):
name: str
country: str
population: int

model = OpenAIChatModel(
"anthropic/claude-sonnet-5",
provider=OpenAIProvider(
api_key="YOUR_EDEN_AI_API_KEY",
base_url="https://api.edenai.run/v3",
),
)

agent = Agent(model, output_type=City)
result = agent.run_sync("Tell me about the capital of France.")
print(result.output) # City(name='Paris', country='France', population=...)
```
</CodeGroup>

## Multi-Turn Conversations

Keep conversation history across runs with `message_history`:

<CodeGroup>
{/* skip-test */}
```python Python
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
"anthropic/claude-sonnet-5",
provider=OpenAIProvider(
api_key="YOUR_EDEN_AI_API_KEY",
base_url="https://api.edenai.run/v3",
),
)
agent = Agent(model, system_prompt="You are a helpful assistant.")

result = agent.run_sync("What is the capital of France?")
print(result.output)

# Continue the conversation with prior context
result = agent.run_sync(
"What's its population?",
message_history=result.all_messages(),
)
print(result.output)
```
</CodeGroup>

## Error Handling

<CodeGroup>
{/* skip-test */}
```python Python
from pydantic_ai import Agent

Check warning on line 154 in v3/integrations/pydantic-ai.mdx

View check run for this annotation

Mintlify / Mintlify Validation (edenai) - vale-spellcheck

v3/integrations/pydantic-ai.mdx#L154

Did you really mean 'pydantic_ai'?
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider
from pydantic_ai.exceptions import ModelHTTPError, UnexpectedModelBehavior

model = OpenAIChatModel(
"openai/gpt-5.5",
provider=OpenAIProvider(
api_key="YOUR_EDEN_AI_API_KEY",
base_url="https://api.edenai.run/v3",
),
)
agent = Agent(model)

try:
result = agent.run_sync("Hello!")
print(result.output)
except ModelHTTPError as e:
print(f"Model HTTP error (auth, rate limit, bad request): {e}")
except UnexpectedModelBehavior as e:
print(f"Unexpected model behavior: {e}")
```
</CodeGroup>

## Environment Variables

<CodeGroup>
```bash .env
EDEN_AI_API_KEY=your_api_key_here
```

{/* skip-test */}
```python Python
import os
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
"openai/gpt-5.5",
provider=OpenAIProvider(
api_key=os.getenv("EDEN_AI_API_KEY"),
base_url="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
- [OpenAI SDK (Python)](/v3/integrations/openai-sdk-python) - Direct SDK usage
Loading