AI Provider API Reference
Quick reference for 7 providers — endpoints, auth, models, SDK examples.
OpenAI
Base URL:
https://api.openai.com/v1Auth:
BearerSDK
Install
npm install openai Import
import OpenAI from 'openai'; Quick example
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello, world!' }],
max_tokens: 256,
});
console.log(response.choices[0].message.content); Models
| ID | Name | Type | Context |
|---|---|---|---|
gpt-4o | GPT-4o | chat | 128K |
gpt-4o-mini | GPT-4o mini | chat | 128K |
gpt-4-turbo | GPT-4 Turbo | chat | 128K |
o3 | o3 | chat | 200K |
o4-mini | o4-mini | chat | 200K |
text-embedding-3-large | Embedding 3 Large | embedding | — |
text-embedding-3-small | Embedding 3 Small | embedding | — |
dall-e-3 | DALL-E 3 | image | — |
Endpoints
About
This reference covers the REST API fundamentals for 7 major LLM providers: OpenAI, Anthropic, Google (Gemini), Mistral, Cohere, Groq, and Together.ai. For each provider you get: the base URL, authentication method, current model IDs, SDK install/import snippet, request/response JSON examples for chat completions, and links to official documentation. All examples show real API formats — no placeholders.
How to use
- 1 Click a provider tab to switch between APIs.
- 2 Copy the SDK install command to add the official library to your project.
- 3 Use the request/response examples as starting templates for your own API calls.
- 4 The models table lists current model IDs — use these exact strings in your API requests.
- 5 Click "Docs" to open the official provider documentation.
- What is the difference between OpenAI and Anthropic authentication?
- OpenAI uses the header Authorization: Bearer YOUR_API_KEY. Anthropic uses x-api-key: YOUR_API_KEY plus the required anthropic-version header (e.g., 2023-06-01). Google Gemini uses either an API key query parameter or OAuth 2.0 Bearer tokens depending on the endpoint.
- Can I use OpenAI-compatible endpoints with non-OpenAI providers?
- Yes — Groq, Together.ai, and many other providers offer OpenAI-compatible endpoints at their own base URLs. You can often just change the baseURL in the OpenAI SDK and keep the same code. Anthropic and Google have their own incompatible request formats.
- What is the anthropic-version header?
- Anthropic requires a dated version header to ensure stable API behavior as the API evolves. New features and response formats are introduced in new API versions. Using an older version guarantees your existing code keeps working. The current stable version is 2023-06-01.