Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(blocks/llm): Fix AI/ML API URL (#14154)

Hugo7d95995feef1
diff --git a/autogpt_platform/backend/backend/blocks/_static_provider_configs.py b/autogpt_platform/backend/backend/blocks/_static_provider_configs.py
index ede78eec87..4e8fa0e8ef 100644
--- a/autogpt_platform/backend/backend/blocks/_static_provider_configs.py
+++ b/autogpt_platform/backend/backend/blocks/_static_provider_configs.py
@@ -21,7 +21,7 @@ from backend.sdk import ProviderBuilder
_STATIC_PROVIDER_CONFIGS: dict[str, tuple[str, tuple[CredentialsType, ...]]] = {
# LLM providers that share blocks/llm.py
- "aiml_api": ("Unified access to 100+ AI models", ("api_key",)),
+ "aiml_api": ("Unified access to 1,000+ AI models", ("api_key",)),
"anthropic": ("Claude language models", ("api_key",)),
"codex": ("Use your ChatGPT plan with Codex App Server", ("oauth2",)),
"microsoft_365_copilot": (
diff --git a/autogpt_platform/backend/backend/util/llm/providers.py b/autogpt_platform/backend/backend/util/llm/providers.py
index b08cc2f3a0..ee84e5948c 100644
--- a/autogpt_platform/backend/backend/util/llm/providers.py
+++ b/autogpt_platform/backend/backend/util/llm/providers.py
@@ -403,7 +403,7 @@ async def _dispatch_sync(
)
if provider == "aiml_api":
return await _call_openai_compat(
- base_url="https://api.aimlapi.com/v2",
+ base_url="https://api.aimlapi.com/v1",
model=model,
api_key=api_key,
messages=messages,
@@ -418,6 +418,8 @@ async def _dispatch_sync(
"X-Project": "AutoGPT",
"X-Title": "AutoGPT",
"HTTP-Referer": "https://github.com/Significant-Gravitas/AutoGPT",
+ "X-AIMLAPI-Source": "agent/autogpt",
+ "X-AIMLAPI-Partner-ID": "part_T70zDIEvQLKSMzMQ7asjdtKR",
},
)
if provider == "v0":
diff --git a/autogpt_platform/backend/backend/util/llm/providers_test.py b/autogpt_platform/backend/backend/util/llm/providers_test.py
index 697ae1a97b..f5e91130d0 100644
--- a/autogpt_platform/backend/backend/util/llm/providers_test.py
+++ b/autogpt_platform/backend/backend/util/llm/providers_test.py
@@ -783,6 +783,14 @@ class TestAIMLAPI:
# AI/ML expects branded headers on the client construction.
ctor_kwargs = constructor.call_args.kwargs
assert ctor_kwargs["default_headers"]["X-Project"] == "AutoGPT"
+ # AI/ML API is served under /v1 (the /v2 host does not exist).
+ assert ctor_kwargs["base_url"] == "https://api.aimlapi.com/v1"
+ # Attribution headers identify agent-originated traffic to the provider.
+ assert ctor_kwargs["default_headers"]["X-AIMLAPI-Source"] == "agent/autogpt"
+ assert (
+ ctor_kwargs["default_headers"]["X-AIMLAPI-Partner-ID"]
+ == "part_T70zDIEvQLKSMzMQ7asjdtKR"
+ )
# ---------------------------------------------------------------------------
diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/helpers.test.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/helpers.test.ts
index 7c2c536028..03be38a74c 100644
--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/helpers.test.ts
+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/__tests__/helpers.test.ts
@@ -47,6 +47,7 @@ describe("formatProviderName", () => {
expect(formatProviderName("github")).toBe("GitHub");
expect(formatProviderName("d_id")).toBe("D-ID");
expect(formatProviderName("twitter")).toBe("X");
+ expect(formatProviderName("aiml_api")).toBe("AI/ML API");
});
test("title-cases unknown snake_case slugs", () => {
diff --git a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/helpers.ts b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/helpers.ts
index d14d40b5e7..150bc6d730 100644
--- a/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/helpers.ts
+++ b/autogpt_platform/frontend/src/components/contextual/IntegrationsPanel/helpers.ts
@@ -39,6 +39,7 @@ export function typeBadgeLabel(type: CredentialType): string {
}
const PROVIDER_DISPLAY_NAME_OVERRIDES: Record<string, string> = {
+ aiml_api: "AI/ML API",
github: "GitHub",
google: "Google",
google_maps: "Google Maps",
diff --git a/autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/helpers.ts b/autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/helpers.ts
index 1cabafe003..dfca76d21c 100644
--- a/autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/helpers.ts
+++ b/autogpt_platform/frontend/src/components/renderers/InputRenderer/custom/CredentialField/helpers.ts
@@ -62,7 +62,7 @@ export const filterCredentialsByProvider = (
export function toDisplayName(provider: string): string {
// Special cases that need manual handling
const specialCases: Record<string, string> = {
- aiml_api: "AI/ML",
+ aiml_api: "AI/ML API",
d_id: "D-ID",
e2b: "E2B",
llama_api: "Llama API",
diff --git a/autogpt_platform/frontend/src/providers/agent-credentials/helper.ts b/autogpt_platform/frontend/src/providers/agent-credentials/helper.ts
index dfe430037c..6eb11375b0 100644
--- a/autogpt_platform/frontend/src/providers/agent-credentials/helper.ts
+++ b/autogpt_platform/frontend/src/providers/agent-credentials/helper.ts
@@ -5,7 +5,7 @@ export function toDisplayName(provider: unknown): string {
// Special cases that need manual handling
const specialCases: Record<string, string> = {
- aiml_api: "AI/ML",
+ aiml_api: "AI/ML API",
d_id: "D-ID",
e2b: "E2B",
llama_api: "Llama API",