Integration

Free LLM APIs With OpenAI-Compatible Endpoints: Drop-In Client Config

The OpenAI Chat Completions API specification is the universal standard for LLM integration. By choosing providers that mirror this interface, developers prevent vendor lock-in and can switch between free and paid endpoints dynamically with a single configuration flag.

Interactive AI Model Explorer

Want to calculate your exact parameters and operational expenses? Run the calculations locally inside your browser.

Launch AI Model Explorer

1. Endpoint Configuration Directory (2026)

ProviderBase URLTop Free Model IDKey Header
**Groq Cloud**`https://api.groq.com/openai/v1``llama-3.3-70b-versatile``Authorization: Bearer gsk_...`
**OpenRouter**`https://openrouter.ai/api/v1``meta-llama/llama-3.3-70b-instruct:free``Authorization: Bearer sk-or-...`
**GitHub Models**`https://models.inference.ai.azure.com``gpt-4o-mini``Authorization: Bearer ghp_...`
**Mistral AI**`https://api.mistral.ai/v1``mistral-small-latest``Authorization: Bearer ...`
**Together AI**`https://api.together.xyz/v1``meta-llama/Llama-3.3-70B-Instruct-Turbo``Authorization: Bearer ...`

2. Multi-Provider Client Factory Pattern (TypeScript)

Create a factory function to route traffic across providers dynamically:

```typescript import OpenAI from 'openai';

export type ProviderName = 'groq' | 'openrouter' | 'github';

export function getLLMClient(provider: ProviderName = 'groq') { const configs = { groq: { baseURL: 'https://api.groq.com/openai/v1', apiKey: process.env.GROQ_API_KEY, defaultModel: 'llama-3.3-70b-versatile', }, openrouter: { baseURL: 'https://openrouter.ai/api/v1', apiKey: process.env.OPENROUTER_API_KEY, defaultModel: 'meta-llama/llama-3.3-70b-instruct:free', }, github: { baseURL: 'https://models.inference.ai.azure.com', apiKey: process.env.GITHUB_TOKEN, defaultModel: 'gpt-4o-mini', }, };

const config = configs[provider]; return { client: new OpenAI({ baseURL: config.baseURL, apiKey: config.apiKey }), model: config.defaultModel, }; } ```

Frequently Asked Questions

Do OpenAI-compatible endpoints support streaming?

Yes. All standard OpenAI clients (stream: true) work out of the box with Server-Sent Events (SSE) across Groq, OpenRouter, and GitHub Models.

Can I use curl to test these endpoints?

Yes. Simply send a standard POST request with a JSON body to the provider’s /chat/completions path.