# AI/ML API > One API key for 800+ AI models from OpenAI, Anthropic, Google, xAI, DeepSeek, Alibaba, Kling, ByteDance, ElevenLabs and other providers: chat, reasoning, images, video, speech, music, embeddings, OCR and 3D. The API is OpenAI-compatible, and Claude models also answer on the Anthropic Messages API. Billing is pay-as-you-go from one USD balance. ## Connect - OpenAI SDKs: `base_url = "https://api.aimlapi.com/v1"`, `api_key = `. Every chat model, including Claude and Gemini, works on `POST /v1/chat/completions`. - Anthropic SDKs and Claude Code: base URL `https://api.aimlapi.com` (the SDK adds `/v1/messages`), API key = the AI/ML API key. - Auth header: `Authorization: Bearer ` (`x-api-key: ` also works). Keys are created at https://aimlapi.com/app/keys after sign-in. - Model ids are `vendor/model`, for example `openai/gpt-6.1-terra`, `anthropic/claude-sonnet-5.5`, `google/gemini-4-hydrogen`. Take ids from `GET /v1/models`; do not guess them. ```bash curl https://api.aimlapi.com/v1/chat/completions \ -H "Authorization: Bearer $AIMLAPI_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "openai/gpt-6.1-terra", "messages": [{"role": "user", "content": "Hello"}]}' ``` ## Endpoints by task - Chat and reasoning: `POST /v1/chat/completions`; OpenAI Responses API: `POST /v1/responses`; Anthropic Messages API: `POST /v1/messages`. - Images: `POST /v1/images/generations`. - Video: `POST /v2/video/generations` returns a generation `id`; poll `GET /v2/video/generations?generation_id=` until `status` is `completed`, then read `video.url`. Statuses: `queued`, `generating`, `completed`, `error`. ```bash curl https://api.aimlapi.com/v2/video/generations \ -H "Authorization: Bearer $AIMLAPI_KEY" -H "Content-Type: application/json" \ -d '{"model": "kling-video/v4/text-to-video", "prompt": "A calm lake at sunrise", "duration": 5}' curl "https://api.aimlapi.com/v2/video/generations?generation_id=" -H "Authorization: Bearer $AIMLAPI_KEY" ``` - Embeddings: `POST /v1/embeddings`. - Speech, music, OCR, 3D: each model's page in the docs gives its endpoint and parameters: https://docs.aimlapi.com/llms.txt - Account balance: `GET /v2/billing` returns `current_balance` and `currency` (USD). ## Machine-readable sources - [Model catalogue](https://api.aimlapi.com/v1/models): every model you can call now, with id, aliases, endpoint type, context length and a link to its request schema in `info.docsJson`. Find models for a task with `?output_modalities=video` (or `image`, `audio`, `text`) or `?type=`; `?id=` takes an exact id or alias, not a search term. Add `include=pricing` for prices: in pricing units, `origin: provided` is the input you send and `origin: generated` is the model's output, and `price` is USD per `per` units. Some models carry extra units for long-context tiers, cached input and batch; the plain input and output units are the standard price. - [Model deprecations](https://api.aimlapi.com/v1/models/deprecations): why an id is missing from the catalogue. `deprecated` still serves until `shutdown_at`, `superseded` resolves to `replaced_by`, `withdrawn` returns 404. - Request schema of one model: `https://api.aimlapi.com/docs-json?model=&endpoint=` (OpenAPI JSON, linked from each catalogue entry). - [Docs index for agents](https://docs.aimlapi.com/llms.txt): every docs page. Add `.md` to any docs URL to get Markdown, or ask the docs a question with `GET https://docs.aimlapi.com/index.md?ask=&goal=`. ## Docs - [Quickstart](https://docs.aimlapi.com/quickstart/simple-model.md): first request in Python, JavaScript or curl. - [Supported SDKs](https://docs.aimlapi.com/quickstart/supported-sdks.md): OpenAI and other SDK setup with the right base URL. - [CLI](https://docs.aimlapi.com/quickstart/cli.md): `npx aimlapi claude` connects Claude Code; the same CLI sets up Codex, OpenCode, Cline and other coding agents. - [Complete model list](https://docs.aimlapi.com/api-references/service-endpoints/complete-model-list.md): filters and fields of `GET /v1/models`. - [All model ids](https://docs.aimlapi.com/api-references/model-database.md): ids grouped by task, with links to each model's API reference. - [Account balance](https://docs.aimlapi.com/api-references/service-endpoints/account-balance.md): balance, billing detail and transactions. - [MCP server](https://docs.aimlapi.com/quickstart/mcp.md): connect MCP clients to AI/ML API. ## Optional - [Models](https://aimlapi.com/models): model pages with prices, benchmarks and an agent-ready request for each model. - [Pricing](https://aimlapi.com/ai-ml-api-pricing): prices for people; agents should read `include=pricing` from the catalogue instead. - [Help center](https://help.aimlapi.com/): account, billing and API key questions. - [Blog](https://aimlapi.com/blog): model reviews, comparisons and guides.