# What Is the OpenAI-Compatible Endpoint Provided by FreeLLMAPI?

> Discover FreeLLMAPI's OpenAI-compatible endpoint. Effortlessly integrate existing OpenAI clients with downstream LLM providers using our standard API contract. Explore today.

- Repository: [Tashfeen/freellmapi](https://github.com/tashfeenahmed/freellmapi)
- Tags: getting-started
- Published: 2026-09-02

---

**FreeLLMAPI exposes a fully OpenAI-compatible HTTP API at `https://api.free.llmapi.com/v1` that allows existing OpenAI client libraries to work without modification by forwarding requests to downstream LLM providers while preserving the standard request-response contract.**

FreeLLMAPI is an open-source aggregation gateway hosted at `tashfeenahmed/freellmapi` that unifies multiple large language model providers behind a single interface. The **OpenAI-compatible endpoint** implemented in the server source code enables developers to use standard OpenAI SDKs and tools by simply changing the base URL, requiring zero changes to request formats or application logic.

## Endpoint URL and Base Configuration

The OpenAI-compatible base URL is hardcoded in the provider configuration at [`server/src/providers/openai-compat.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/openai-compat.ts):

```typescript
baseURL: "https://api.free.llmapi.com/v1"

```

This endpoint serves as the drop-in replacement for `https://api.openai.com/v1`. The provider registration occurs in [`server/src/providers/index.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/index.ts), which integrates the compatibility layer into the server's routing system.

## Supported API Routes

FreeLLMAPI supports the complete OpenAI API surface at this endpoint. All standard routes are available under the `/v1` path:

- **`/v1/chat/completions`** – Conversational AI with multi-turn context
- **`/v1/completions`** – Legacy text completion endpoints  
- **`/v1/embeddings`** – Vector representation generation

Each route accepts identical JSON payloads to the official OpenAI API and returns responses in the familiar schema, including `choices`, `usage`, and `model` fields.

## Implementation Architecture

According to the source code in [`server/src/providers/openai-compat.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/openai-compat.ts), the provider functions as a transparent translation layer between client applications and downstream LLM services. The implementation receives standard OpenAI-formatted HTTP requests, authenticates the Bearer token, forwards the payload to configured backend providers, and transforms the upstream response back into the OpenAI JSON schema before returning it to the client.

## Usage Examples

### Using the OpenAI Node SDK

Target the **OpenAI-compatible endpoint** by overriding the `baseURL` parameter while keeping all other method calls identical:

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.free.llmapi.com/v1",
  apiKey: "YOUR_FREE_LLMAPI_KEY",
});

const chat = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Hello, world!" }],
});

console.log(chat.choices[0].message.content);

```

### Using Plain Fetch

Send HTTP requests directly to the endpoint without any SDK:

```javascript
const response = await fetch(
  "https://api.free.llmapi.com/v1/chat/completions",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer YOUR_FREE_LLMAPI_KEY",
    },
    body: JSON.stringify({
      model: "gpt-4o-mini",
      messages: [{ role: "user", content: "What's the weather today?" }],
    }),
  },
);

const data = await response.json();
console.log(data.choices[0].message.content);

```

### Generating Embeddings

Access embedding models through the same compatible interface:

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.free.llmapi.com/v1",
  apiKey: "YOUR_FREE_LLMAPI_KEY",
});

const embed = await client.embeddings.create({
  model: "text-embedding-3-large",
  input: ["Free LLMAPI provides OpenAI-compatible access."],
});

console.log(embed.data[0].embedding);

```

## Summary

- The **OpenAI-compatible endpoint** is hosted at `https://api.free.llmapi.com/v1` as defined in [`server/src/providers/openai-compat.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/openai-compat.ts)
- Full support for standard routes including `/v1/chat/completions`, `/v1/completions`, and `/v1/embeddings`
- The provider architecture in [`server/src/providers/index.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/index.ts) registers this compatibility layer alongside other LLM providers
- Authentication uses standard Bearer tokens in the `Authorization` header
- Zero code changes required beyond updating the `baseURL` in existing OpenAI client configurations

## Frequently Asked Questions

### What is the exact base URL for the FreeLLMAPI OpenAI-compatible endpoint?

The base URL is `https://api.free.llmapi.com/v1`, configured in the OpenAI-compat provider at [`server/src/providers/openai-compat.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/openai-compat.ts). This single endpoint replaces `https://api.openai.com/v1` in any client library or HTTP request.

### Do I need to modify request payloads when switching from OpenAI to FreeLLMAPI?

No. The provider implementation preserves the complete OpenAI request-response contract. Headers, JSON body structure, and response formats remain identical to the official OpenAI API, allowing seamless migration by changing only the `baseURL` parameter.

### Which models are available through the OpenAI-compatible endpoint?

FreeLLMAPI supports any model identifier configured in your downstream providers, including `gpt-4o-mini`, `text-embedding-3-large`, and other popular LLMs. The `/v1/models` endpoint returns the complete list of available models mapped through the gateway.

### How does the provider handle authentication for the compatible endpoint?

The system validates the `Authorization` header containing your FreeLLMAPI key at the edge before routing to backend providers. As implemented in [`server/src/providers/openai-compat.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/openai-compat.ts), the gateway strips this authentication and manages separate credentials for upstream LLM services transparently.