Skip to content

feat: Add AIMLAPI provider support to AI plugins#12379

Merged
Baoyuantop merged 4 commits into
apache:masterfrom
D1m7asis:master
Jul 2, 2025
Merged

feat: Add AIMLAPI provider support to AI plugins#12379
Baoyuantop merged 4 commits into
apache:masterfrom
D1m7asis:master

Conversation

@D1m7asis

Copy link
Copy Markdown
Contributor

Description

This PR adds AIMLAPI as a supported provider to the ai-proxy, ai-proxy-multi, and ai-request-rewrite plugins in Apache APISIX. AIMLAPI provides a unified OpenAI-compatible API with access to 300+ LLMs such as GPT-4, Claude, Gemini, DeepSeek, and others.

Motivation

AIMLAPI is used by over 150,000 developers and organizations as a centralized LLM API gateway. It supports OpenAI-compatible request formats and offers strong uptime, competitive pricing, and access to a wide variety of models. This change enables APISIX users to easily route and proxy requests through AIMLAPI without needing custom drivers or overrides.

What's Changed

  • ✅ Added a new OpenAI-compatible driver: aimlapi.lua

  • ✅ Updated provider enums in:

    • ai-proxy schema
    • ai-request-rewrite schema
    • ai-proxy-multi schema
  • ✅ Updated documentation to reflect AIMLAPI as an officially supported provider

  • ✅ Clarified examples, usage, and endpoint behavior for AIMLAPI

  • ✅ Confirmed backwards compatibility and fallback behavior

Test Screenshots:
Screenshot 2025-06-24 192252
Screenshot 2025-06-24 192420

Which issue(s) this PR fixes:

#12289 — new provider integration


Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

Introduced AIMLAPI as a supported provider in ai-proxy, ai-request-rewrite, and related schema and documentation. Added a new driver for AIMLAPI, updated provider enums, and clarified documentation to reflect AIMLAPI integration.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request plugin labels Jun 25, 2025

@Baoyuantop Baoyuantop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduces a new test case to verify schema validation when using the 'aimlapi' provider with authorization header in the ai-request-rewrite plugin.
@D1m7asis

Copy link
Copy Markdown
Contributor Author

@Baoyuantop Thanks for the note!

Test cases for provider = "aimlapi" have been added and verified.
They cover both validation and request behavior, similar to the existing ones for openai and deepseek.

Relevant test output:

ok 13 - TEST 5: provider must be one of: deepseek, openai, aimlapi, openai-compatible - status code ok
ok 14 - TEST 5: ... - response_body - response is expected
ok 15 - TEST 5: ... - pattern "[error]" does not match a line in error.log

ok 46 - TEST 15: provider aimlapi - status code ok
ok 47 - TEST 15: provider aimlapi - response_body - response is expected
ok 48 - TEST 15: provider aimlapi - pattern "[error]" does not match a line in error.log

@Baoyuantop

Copy link
Copy Markdown
Contributor

Hi @D1m7asis, there is a code lint error that needs to be fixed.

Reformatted the 'provider' enum lists in ai-proxy/schema.lua and ai-request-rewrite.lua to use multi-line arrays for improved readability and maintainability. No functional changes were made.
@Baoyuantop

Copy link
Copy Markdown
Contributor

Hi @D1m7asis, there is also a code lint error that needs to be fixed.

@D1m7asis

D1m7asis commented Jul 1, 2025

Copy link
Copy Markdown
Contributor Author

Sorry, didn’t notice that earlier - fixed the style issue in ai-request-rewrite.t

Let me know if anything else needs adjustment 🙌

@Baoyuantop Baoyuantop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and it works.

@Baoyuantop
Baoyuantop merged commit ff8c350 into apache:master Jul 2, 2025
26 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in ⚡️ Apache APISIX Roadmap Jul 2, 2025
@OctavianTheI

Copy link
Copy Markdown

@Baoyuantop @membphis @bzp2010
Guys, let me know if your team would like to capitalize on this integration with any crosspromo - we'd be glad to release a couple of tutorials and more

If that sounds interesting, please send the responsible person's email to [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request plugin size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants