For the complete documentation index, see llms.txt. This page is also available as Markdown.

MCP

Connect AI/ML API to your AI client β€” Claude Desktop, Claude (web), Cursor, Claude Code, and other MCP-capable apps β€” over the Model Context Protocol using OAuth.

You sign in with your AI/ML API account in the browser; there is no API key to copy or paste. Once connected, you can discover and compare models, run inference (LLM / image / video / audio / embeddings), manage long-running generation jobs, and check your balance β€” directly from the client.

Usage is billed to your AIMLAPI account, exactly like the REST API.

Prefer to paste an API key instead of signing in? That method is also supported β€” add an Authorization: Bearer <YOUR_AIMLAPI_KEY> header instead of using OAuth. This guide covers the OAuth (browser sign-in) flow.


Prerequisites

  • An AI/ML API account β€” create one at https://aimlapi.com.

  • A client that supports remote MCP servers over Streamable HTTP with OAuth (all clients below do).

  • A balance on your account if you plan to run billable inference (top up at https://aimlapi.com/app/billing).

Endpoint

Environment
MCP URL

Production

https://mcp.aimlapi.com/mcp

You only ever enter this one URL. Your client discovers everything else (the sign-in page, how to register, how to get a token) automatically.

How the OAuth connection works

1

Contacts the MCP server

When you add the server URL without an API key, your client contacts the MCP server and is told that authentication is required.

2

Discovers the authorization server

Your client automatically discovers the AIMLAPI authorization server.

3

Registers and opens your browser

Your client registers itself and opens your browser.

4

Signs you in and connects

You sign in to AI/ML API and approve access; the client receives a token and connects.

You never handle a key. The client stores the token securely and refreshes it for you.


Claude Desktop

1

Open the connector settings

Go to Settings β†’ Connectors β†’ Add custom connector.

2

Add AIMLAPI

Set Name: AIMLAPI Β· Remote MCP server URL: https://mcp.aimlapi.com/mcp

3

Sign in and connect

Click Add. A browser window opens β†’ sign in to AIMLAPI β†’ approve access.

The connector appears as connected, and the AI/ML API tools become available in your chats.

Claude (web β€” claude.ai)

1

Open connector settings

Open Settings β†’ Connectors β†’ Add custom connector.

On Team/Enterprise plans this is done by an Owner under Organization settings β†’ Connectors.

2

Add the server URL

Enter the URL https://mcp.aimlapi.com/mcp and add it.

3

Complete the browser flow

A browser flow opens β†’ sign in to AI/ML API β†’ approve β†’ connected.

Custom-connector availability depends on your Claude plan.

Cursor

Add the server to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project). Do not add a headers block β€” leaving it out is what triggers the OAuth flow:

1

Open Cursor tools settings

Open Cursor Settings β†’ Tools & Integrations, find aimlapi, and click Login.

2

Sign in and allow access

A browser opens β†’ sign in to AI/ML API β†’ Allow.

3

Confirm connection

The server turns green when connected.

Claude Code

1

Open the MCP menu

Inside an interactive Claude Code session, run /mcp.

2

Select AIMLAPI

Select aimlapi and choose Authenticate.

3

Sign in in the browser

A browser opens for you to sign in. (Do not pass an --header flag; that switches the client to API-key auth instead of OAuth.)

Other MCP clients

Any client implementing the MCP authorization spec (OAuth 2.1 + PKCE with dynamic client registration) works the same way: point it at https://mcp.aimlapi.com/mcp with no API key and complete the browser sign-in.

To inspect the flow step by step, use the MCP Inspector:

Set Transport = Streamable HTTP, URL = https://mcp.aimlapi.com/mcp, then use Open Auth Settings β†’ Quick OAuth Flow.


What you can do once connected

  • Discover models β€” search and compare the catalog, and get a comparable headline price for each.

  • Run inference β€” LLM chat, embeddings, image / video / audio generation.

  • Manage jobs β€” submit long-running generations and poll their status/results.

  • Account β€” check your balance and usage.

Every call is billed to your AI/ML API account, just like the REST API.

Managing the connection

To stop using AI/ML API from a client, remove or disconnect the AI/ML API connector in that client's settings.

Troubleshooting

Symptom
Fix

Browser didn't open, or the client is stuck "connecting"

Remove the connector and add it again; make sure you completed the AI/ML API sign-in in the browser.

Connected, but inference fails with an insufficient-balance error

The client connects but never asks you to sign in

You likely added an Authorization header β€” with a header the client uses API-key auth, not OAuth. Remove the header to use OAuth.

"Sign-in failed" / authorization error

Confirm you're signing in to the correct AI/ML API account, then retry from the client.

Last updated

Was this helpful?