AI APIs: a guide for developers
Updated · AI to Choose
An AI API lets your website or software send a request (text, image, audio) to a model and receive the answer as JSON. Most providers charge per token, with different prices for input and output, and use a format compatible with OpenAI’s, so you can switch models by changing only the base URL and model name.
How does an AI API work?
- You create an account with the provider and generate a secret API key.
- Your server sends an HTTPS (POST) request with the chosen model, the messages and settings such as temperature.
- The provider returns the answer as JSON, optionally streamed so you can display it word by word.
- You are billed for the tokens used: roughly 1 token = ¾ of an English word.
Choosing the right API
| Criterion | What to check |
|---|---|
| Price | Price per million input and output tokens, discounts for caching and batch processing |
| Quality | Tests on your own examples, more reliable than generic leaderboards |
| Context window | Amount of text processed at once (long documents, history) |
| Speed | Time to first token and tokens per second |
| Data and GDPR | Hosting (EU or not), retention, no training on your data, data processing agreement |
| Limits | Requests and tokens per minute, daily quotas |
| Features | Tool calling, structured JSON output, vision, audio, embeddings |
Tip: start with a fast, inexpensive model and only switch to the most powerful one for tasks that need it.
Code samples
“OpenAI-compatible” format, accepted by many providers and by Ollama locally. Replace the URL and model ID with your provider’s.
curl https://api.example-provider.com/v1/chat/completions \
-H "Authorization: Bearer $AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-id",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Summarise this text in 3 bullet points: ..."}
],
"temperature": 0.3,
"max_tokens": 400
}'import os, requests
resp = requests.post(
"https://api.example-provider.com/v1/chat/completions",
headers={"Authorization": f"Bearer {os.environ['AI_API_KEY']}"},
json={
"model": "your-model-id",
"messages": [{"role": "user", "content": "Write a product description for ..."}],
"temperature": 0.7,
},
timeout=60,
)
resp.raise_for_status()
print(resp.json()["choices"][0]["message"]["content"])<?php
$ch = curl_init('https://api.example-provider.com/v1/chat/completions');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('AI_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'your-model-id',
'messages' => [['role' => 'user', 'content' => 'Translate into English: ...']],
]),
]);
$data = json_decode(curl_exec($ch), true);
echo $data['choices'][0]['message']['content'] ?? 'Error';const res = await fetch("https://api.example-provider.com/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.AI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "your-model-id",
messages: [{ role: "user", content: "Give me 5 blog post ideas about ..." }],
}),
});
const data = await res.json();
console.log(data.choices[0].message.content);# 1. Install Ollama (ollama.com), then download a model:
ollama pull llama3.2
# 2. Same OpenAI-compatible format, on your own machine:
curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "llama3.2", "messages": [{"role": "user", "content": "Hello!"}]}'# Public catalog of the AI tools listed on AI to Choose (JSON, free to reuse with a link)
curl "https://www.aitochoose.com/api/catalog.json?lang=en"
# Python: list free AI tools that offer an API
import requests
ais = requests.get("https://www.aitochoose.com/api/catalog.json?lang=en", timeout=30).json()
for ai in ais["items"]:
if ai["api"] and ai["pricing"]["free_tier"]:
print(ai["name"], ai["website"], ai["url"])AI tools in the directory with an API
| AI | Editor | API price (input / output, 1M tokens) | Main plan |
|---|---|---|---|
| DoubaoVersatile AI assistant for chat, content creation, and productivity. | ByteDance | 0.83 $ / 4.15 $doubao-seed-2.1-pro API documentation ↗ | 68 ¥ / month |
| ClaudeConversational AI assistant focused on reasoning, coding, and secure writing. | Anthropic | 2 $ / 10 $Claude Sonnet 5.5 API documentation ↗ | 20 $ / month |
| ChatGPTVersatile AI assistant for chat, writing, coding, and data analysis. | OpenAI | 2 $ / 10 $gpt-6.1-sol API documentation ↗ | 8 $ / month |
| GigaChatMultimodal AI assistant developed by Sber, specialized in the Russian language. | Sberbank | 0.89 $ / 2.14 $GigaChat 3 Pro API documentation ↗ | Free |
| KimiMultimodal AI assistant with search, coding, and autonomous agent capabilities. | Moonshot AI | 2 $ / 10 $kimi-k3.1-pro API documentation ↗ | 19 $ / month |
| Sarvam AISovereign AI platform specialized in Indian languages and context. | Axonwise Private Limited | 0.11 $ / 0.27 $Sarvam 105B API documentation ↗ | 9,999 ₹ / month |
| Google GeminiGoogle's multimodal AI assistant for writing, planning, and analysis. | 3 $ / 15 $gemini-4-neon API documentation ↗ | 4.99 $ / month | |
| Z.ai (GLM)Multimodal AI assistant powered by GLM models, specialized in code and agents. | Zhipu AI | 1.4 $ / 4.4 $GLM-5.3 API documentation ↗ | Free |
| Qwen ChatMultimodal AI assistant and model platform developed by Alibaba Cloud. | Alibaba Cloud | 1.5 $ / 4.5 $qwen4-max API documentation ↗ | 6 $ / month |
| ERNIE BotVersatile AI assistant for productivity, research, and content creation. | Baidu | 0.56 $ / 2.53 $ERNIE-5.1 API documentation ↗ | Free |
| DeepSeekHigh-performance AI assistant focused on reasoning and coding, available for free. | Hangzhou DeepSeek Artificial Intelligence Basic Technology Research Co., Ltd. | 0.14 $ / 0.28 $deepseek-v4-flash API documentation ↗ | Free |
| Le ChatConversational AI assistant and coding agent developed by Mistral AI. | Mistral AI | 1.36 $ / 4.18 $Mistral Large 4 API documentation ↗ | 14.99 $ / month |
| Gemini pour WorkspaceIntegrate Gemini generative AI into your daily work tools like Gmail, Docs, and Meet. | 2 $ / 10 $gemini-4-argon API documentation ↗ | 9.2 CA$ / month | |
| FeloMultilingual AI platform for research, exploration, and content creation. | Felo Inc. | 0.1 $ / 0.5 $gpt-6-luna API documentation ↗ | 14.99 $ / month |
| OllamaRun and scale open source AI models locally or in the cloud. | Ollama Inc. | 0.02 $ / 0.6 $nemotron-3-super API documentation ↗ | 20 $ / month |
| Inworld AIReal-time voice models and LLM inference for interactive applications. | Theai, Inc. | 0.07 $ / 0.34 $Gemma 4 26B API documentation ↗ | 25 $ / month |
| Mistral CodeOpen and sovereign AI models for businesses and developers. | Mistral AI SAS | 0.5 $ / 1.5 $Mistral Large API documentation ↗ | 14.99 $ / month |
| v0Collaborative AI assistant for designing and generating full-stack web applications. | Vercel | 4 $ / 20 $v0 Max API documentation ↗ | 30 $ / month |
| Browser UseAI agents for the web and stealth browser infrastructure for automation. | Browser Use | 0.2 $ / 1 $BU 4.0 Mini API documentation ↗ | Free |
| QwenHigh-performance multimodal AI model family for text, code, image, and video. | Alibaba Cloud | 2 $ / 6 $Qwen3.8-Max API documentation ↗ | Free |
| APIroveA single API to generate text, images, and videos with various models. | APIrove | 1 $ / 5 $gpt-6.1-sol API documentation ↗ | Pay as you go |
| Meta AIPersonal AI assistant integrated into Meta apps to chat, create, and automate. | Meta Platforms | — API documentation ↗ | Free |
| PoeUnified platform to access the best AI models and create your own bots. | Quora | — API documentation ↗ | 4.99 $ / month |
| MeshyAI 3D model generator from text or images. | Meshy LLC | — API documentation ↗ | 20 $ / month |
| QontoAll-in-one business account with financial management tools and integrated AI agents. | Qonto SA | — API documentation ↗ | 9 € / month |
| PennylaneAll-in-one financial management and accounting platform for businesses. | Pennylane | — API documentation ↗ | 7 € / month |
| CrispAll-in-one omnichannel customer support platform powered by AI. | Crisp IM SAS | — API documentation ↗ | 45 $ / month |
| Leonardo.AiGenerative creation platform for images and videos. | Leonardo.Ai (Canva) | — API documentation ↗ | 12 $ / month |
| Alice (Yandex)Yandex AI assistant for chat, text writing, and image generation. | Yandex | — API documentation ↗ | Free |
| NotebookLMAI research assistant based on your own documents and sources. | — API documentation ↗ | 4.99 $ / month | |
| Microsoft 365 CopilotAI assistant integrated into the Microsoft 365 ecosystem for productivity and creation. | Microsoft | — API documentation ↗ | 25.2 $ / month |
| DeepL WriteAI writing assistant to improve the grammar, style, and accuracy of your texts. | DeepL SE | — API documentation ↗ | 8.99 € / month |
| NootaSovereign AI assistant for note-taking, meeting management, and email automation. | Noota SAS | — API documentation ↗ | 29 € / month |
| Microsoft 365 CopilotAI assistant for daily productivity, research, and creation. | Microsoft | — API documentation ↗ | Free |
| AgicapCash management and financial steering platform for SMEs and mid-market companies. | Agicap | — API documentation ↗ | Pay as you go |
| TricentisAI-agent-driven quality engineering platform for enterprises. | Tricentis | — API documentation ↗ | 12 $ / month |
| CLOVASovereign language model optimized for Korean culture and language. | NAVER Cloud Corp. | — | Free |
| LovableFull-stack AI application development platform via natural language. | Lovable Labs Incorporated | — API documentation ↗ | 25 $ / month |
| NovelAIUncensored anime image generator and creative writing assistant. | Anlatan Inc. | — API documentation ↗ | 10 $ / month |
| PictoryAI agent and video generator from text, scripts, URLs, or media. | Pictory.ai | — API documentation ↗ | 29.5 $ / month |
| CerenceVoice AI and conversational agents for automotive and intelligent systems. | Cerence Inc. | — API documentation ↗ | Pay as you go |
| DextIntelligent accounting automation platform for businesses and accountants. | Dext | — API documentation ↗ | 31.5 CA$ / month |
| TeamtailorAll-in-one recruitment platform with integrated AI features to optimize the hiring process. | Teamtailor AB | — API documentation ↗ | Pay as you go |
| JanOpen-source application to run AI models locally or via the cloud. | Menlo Research | — API documentation ↗ | Free |
| LanguageToolMultilingual spelling, grammar checker and text rephraser. | LanguageTooler GmbH | — API documentation ↗ | 19.9 € / month |
| MonkAI vehicle inspection for instant condition reports. | Monk AI | — API documentation ↗ | Pay as you go |
| beacon.shSelf-improving open source memory layer for coding agents. | Asymptote Labs, Inc. | — API documentation ↗ | 26.67 $ / month |
| SeldonKubernetes MLOps and LLMOps platform for enterprise AI deployment and governance. | Seldon Technologies Ltd (part of TrueFoundry) | — API documentation ↗ | Free |
| VEEDAI-powered video creation and editing platform for creators and businesses. | VEED | — API documentation ↗ | Free |
| GladiaAI audio infrastructure for transcription and voice data enrichment via API. | Gladia | — API documentation ↗ | Free |
| AgentforceAutonomous AI agent platform integrated into the Salesforce ecosystem. | Salesforce | — API documentation ↗ | 5 $ / month |
| FlowiseOpen source platform for drag-and-drop AI agent development and LLM orchestration. | FlowiseAI Inc. | — API documentation ↗ | 35 $ / month |
| PhiHigh-performance and efficient Small Language Models (SLM) for generative AI. | Microsoft | — API documentation ↗ | Free |
| ComfyUIAI creation engine for image professionals with full workflow control. | Comfy Org | — API documentation ↗ | 16 $ / month |
| Canva Magic StudioIntegrated generative AI suite for visual creation, design, and copywriting. | Canva Pty Ltd | — API documentation ↗ | 18 $ / month |
| GammaAI-powered creation platform for professional presentations, documents, and web pages. | Gamma Tech, Inc. | — API documentation ↗ | 9 $ / month |
| KrutrimAI-focused cloud platform, designed for large-scale model development and deployment. | Krutrim SI Designs Private Limited | — API documentation ↗ | Free |
| PicsartAll-in-one creative platform featuring design tools, photo editing, and AI video generation. | Picsart, Inc. | — / 40 $GPT-6.2 Astra API documentation ↗ | 14.74 $ / month |
| GranolaThe AI notepad for back-to-back meetings, without an intrusive bot. | Granola, Inc. | — API documentation ↗ | 14 $ / month |
| RecraftAI-powered vector image generation and design platform. | Recraft AI | — API documentation ↗ | 20 $ / month |
Best practices and security
- Never put the API key in the browser or in a mobile app: call the API from your server and store the key in an environment variable.
- Cap spending in the provider’s console and limit requests per user.
- Handle errors: retry with increasing delays on 429 (too many requests) or 5xx errors.
- Cache identical answers and use the provider’s prompt caching for long, repeated instructions.
- Personal data: minimise it, inform your users and check where data is hosted.
- Validate outputs: check the JSON you receive and never execute it unchecked (prompt injection).
AI to Choose open data
The directory’s catalogue is free to reuse with a link to the relevant page:
/api/catalog.json: all AI tools (prices, plans, categories, API, local, open source, ratings),langparameter (fr, en, es, de, it, pt).llms.txt: a site summary for answer engines and AI models.
Frequently asked questions
How much does an AI API cost?
From a few cents to tens of dollars per million tokens depending on the model. A typical website chatbot often costs a few dollars a month; providers offer calculators and spending caps.
Are there free AI APIs?
Several providers offer a free quota for testing. For unlimited use at no cost, run an open-source model locally with Ollama, which exposes the same API.
Is it easy to switch providers?
Yes, if you use the OpenAI-compatible format: you often only need to change the base URL, the key and the model name.


























































