docs(blocks): Add AI/ML API integration guide and update LLM headers (#10402)

### Summary
Added a new documentation page and images for integrating AI/ML API with
AutoGPT, including step-by-step instructions. Updated LLM block to send
additional headers for requests to aimlapi.com. Improved provider
listing in index.md and added the new guide to mkdocs navigation. Builds
on and extends the integration work from
https://github.com/Significant-Gravitas/AutoGPT/pull/9996


### Changes 🏗️

This PR introduces official support and documentation for using **AI/ML
API** with the **AutoGPT platform**:

* 📄 **Added a new documentation page** `platform/aimlapi.md` with a
detailed step-by-step integration guide.
* 🖼️ **Added 12+ reference images** to `docs/content/imgs/aimlapi/` for
clear visual walkthrough.
* 🧠 **Updated the LLM block** (`llm.py`) to send extra headers
(`X-Project`, `X-Title`, `Referer`) in requests to `aimlapi.com` for
analytics and source attribution.
* 📚 **Improved provider listing** in `index.md` — added section about
AI/ML API models and benefits.
* 🧭 **Added the new guide to the mkdocs navigation** via `mkdocs.yml`.

---

### Checklist 📋

#### For code changes:

* [x] I have clearly listed my changes in the PR description
* [x] I have made a test plan
* [x] I have tested my changes according to the test plan:

  * [x] Successfully authenticated against `api.aimlapi.com`
  * [x] Verified requests use correct headers
* [x] Confirmed `AI Text Generator` block returns completions for all
supported models
* [x] End-to-end tested: created, saved, and ran agent with AI/ML API
successfully
  * [x] Verified outputs render correctly in the Output panel


No breaking changes introduced. Let me know if you'd like this guide
cross-referenced from other onboarding pages. 

---------

Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
This commit is contained in:
Dmitry
2025-08-13 20:25:58 +02:00
committed by GitHub
parent a135f09336
commit 0dd30e275c
16 changed files with 151 additions and 6 deletions

View File

@@ -676,7 +676,11 @@ async def llm_call(
client = openai.OpenAI(
base_url="https://api.aimlapi.com/v2",
api_key=credentials.api_key.get_secret_value(),
default_headers={"X-Project": "AutoGPT"},
default_headers={
"X-Project": "AutoGPT",
"X-Title": "AutoGPT",
"HTTP-Referer": "https://github.com/Significant-Gravitas/AutoGPT",
},
)
completion = client.chat.completions.create(

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -64,11 +64,12 @@ You can learn more under: [Build your own Blocks](platform/new_blocks.md)
The platform comes pre-integrated with cutting-edge LLM providers:
- OpenAI
- Anthropic
- AI/ML API
- Groq
- Llama
- OpenAI - https://openai.com/
- Anthropic - https://www.anthropic.com/
- Groq - https://groq.com/
- Llama - https://llamaindex.ai/
- AI/ML API - [https://aimlapi.com/](https://aimlapi.com/?utm_source=autogpt&utm_medium=github&utm_campaign=integration)
- AI/ML API provides 300+ AI models including Deepseek, Gemini, ChatGPT. The models run at enterprise-grade rate limits and uptimes.
## License Overview

View File

@@ -0,0 +1,139 @@
# 🧠 Running AI/ML API with AutoGPT
Follow these steps to connect **AI/ML API** with the **AutoGPT** platform for high-performance AI text generation.
---
## ✅ Prerequisites
1. Make sure you have gone through and completed the [AutoGPT Setup Guide](https://docs.agpt.co/platform/getting-started/), and AutoGPT is running locally at `http://localhost:3000`.
2. You have an **API key** from [AI/ML API](https://aimlapi.com/app/keys?utm_source=autogpt&utm_medium=github&utm_campaign=integration).
---
## ⚙️ Setup Steps
### 1. Start AutoGPT Locally
Follow the official guide:
[📖 AutoGPT Getting Started Guide](https://docs.agpt.co/platform/getting-started/)
Make sure AutoGPT is running and accessible at:
[http://localhost:3000](http://localhost:3000)
> 💡 Keep AutoGPT running in a terminal or Docker throughout the session.
![Step 1 AutoGPT Running](../imgs/aimlapi/Step%201%20AutoGPT%20Running.png)
---
### 2. Open the Visual Builder
Open your browser and go to:
[http://localhost:3000/build](http://localhost:3000/build)
Or click **“Build”** in the navigation bar.
![Step 2 Build Screen](../imgs/aimlapi/Step%202%20Build%20Screen.png)
---
### 3. Add an AI Text Generator Block
1. Click the **"Blocks"** button on the left sidebar.
![Step 3 AI Block](../imgs/aimlapi/Step%203%20AI%20Block.png)
2. In the search bar, type `AI Text Generator`.
3. Drag the block into the canvas.
![Step 4 AI Generator Block](../imgs/aimlapi/Step%204%20AI%20Generator%20Block.png)
---
### 4. Select an AI/ML API Model
Click the AI Text Generator block to configure it.
In the **LLM Model** dropdown, select one of the supported models from AI/ML API:
![Step 5 AIMLAPI Models](../imgs/aimlapi/Step%205%20AIMLAPI%20Models.png)
| Model ID | Speed | Reasoning Quality | Best For |
| ---------------------------------------------- | ------ | ----------------- | ------------------------ |
| `Qwen/Qwen2.5-72B-Instruct-Turbo` | Medium | High | Text-based tasks |
| `nvidia/llama-3.1-nemotron-70b-instruct` | Medium | High | Analytics and reasoning |
| `meta-llama/Llama-3.3-70B-Instruct-Turbo` | Low | Very High | Complex multi-step tasks |
| `meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo` | Low | Very High | Deep reasoning |
| `meta-llama/Llama-3.2-3B-Instruct-Turbo` | High | Medium | Fast responses |
> ✅ These models are available via OpenAI-compatible API from [AI/ML API](https://aimlapi.com/app/?utm_source=autogpt&utm_medium=github&utm_campaign=integration)
---
### 5. Configure the Prompt and API Key
Inside the **AI Text Generator** block:
1. Enter your prompt text in the **Prompt** field.
2. Enter your **AI/ML API Key** in the designated field.
🔐 You can get your key from:
[https://aimlapi.com/app/keys/](https://aimlapi.com/app/keys?utm_source=autogpt&utm_medium=github&utm_campaign=integration)
![Key Placeholder](../imgs/aimlapi/Step%206.1%20Key%20Placeholder.png)
![Key Empty](../imgs/aimlapi/Step%206.2%20No%20Fill%20Key%20Placeholder.png)
![Key Filled](../imgs/aimlapi/Step%206.3%20Filled%20Key%20Placeholder.png)
![Overview](../imgs/aimlapi/Step%206.4%20Overview.png)
---
### 6. Save Your Agent
Click the **“Save”** button at the top-right of the builder interface:
1. Give your agent a name (e.g., `aimlapi_test_agent`).
2. Click **“Save Agent”** to confirm.
![Save Agent](../imgs/aimlapi/Step%207.1%20Save.png)
> 💡 Saving allows reuse, scheduling, and chaining in larger workflows.
---
### 7. Run Your Agent
From the workspace:
1. Press **“Run”** next to your saved agent.
2. The request will be sent to the selected AI/ML API model.
![Run Agent](../imgs/aimlapi/Step%208%20Run.png)
---
### 8. View the Output
1. Scroll to the **AI Text Generator** block.
2. Check the **Output** panel below it.
3. You can copy, export, or pass the result to further blocks.
![Agent Output](../imgs/aimlapi/Step%209%20Output.png)
---
## 🔄 Expand Your Agent
Now that AI/ML API is connected, expand your workflow by chaining additional blocks:
* 🔧 **Tools** fetch URLs, call APIs, scrape data
* 🧠 **Memory** retain context across interactions
* ⚙️ **Actions / Chains** create full pipelines
---
🎉 Youre now generating AI responses using enterprise-grade models from **AI/ML API** in **AutoGPT**!

View File

@@ -19,6 +19,7 @@ nav:
- Agent Blocks: platform/agent-blocks.md
- Build your own Blocks: platform/new_blocks.md
- Using Ollama: platform/ollama.md
- Using AI/ML API: platform/aimlapi.md
- Using D-ID: platform/d_id.md
- Blocks: platform/blocks/blocks.md
- Contributing: