---
title: "What is a base URL in an LLM API? With examples | BroadRouter"
description: "The base URL is the root address an SDK puts in front of every API path. How it works in OpenAI-compatible clients, and the mistakes that cause 404 errors."
url: https://broadrouter.com/glossary/base-url/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Base URL

Updated 2026-11-15

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

Also called: API base URL, api\_base, baseURL, OPENAI\_BASE\_URL, endpoint URL

Every request an SDK makes is the base URL plus a path. Get the base URL right and the rest of the client works unchanged.

## How it works

The client joins two parts:

| Part | Example |
| --- | --- |
| Base URL | `https://inference.broadnet.ai/v1` |
| Endpoint path | `/chat/completions` |
| Full request URL | `https://inference.broadnet.ai/v1/chat/completions` |

In code, the parameter name depends on the library:

```python
# Python SDK
client = OpenAI(base_url="https://inference.broadnet.ai/v1", api_key=os.environ["BROADNET_API_KEY"])
```

```js
// Node SDK
const client = new OpenAI({ baseURL: "https://inference.broadnet.ai/v1", apiKey: process.env.BROADNET_API_KEY });
```

Both official SDKs fall back to the `OPENAI_BASE_URL` environment variable, and to OpenAI’s own address when nothing is set. Other tools use names such as `api_base` or `OPENAI_API_BASE`.

## Why it matters

The base URL is what makes an [OpenAI-compatible API](https://broadrouter.com/glossary/openai-compatible-api/) a drop-in change. It also decides where your prompts go and who bills you. A wrong value can send traffic, and your [API key](https://broadrouter.com/glossary/api-key/), to the wrong provider. Keep it in configuration next to the key, not hard-coded in several places.

Routers use the same idea: you point the base URL at the [router](https://broadrouter.com/glossary/llm-router/) instead of at a model provider.

## On BroadNet Inference

The base URL is `https://inference.broadnet.ai/v1` for every model: chat, vision and speech to text. Chat goes to `/chat/completions` and transcription to `/audio/transcriptions`. The [curl quickstart](https://broadrouter.com/guides/curl-quickstart/) shows a first request, and the [LangChain guide](https://broadrouter.com/guides/langchain-openai-base-url/) shows where the setting lives in a framework.

## Common mistakes

-   **Missing `/v1`.** `https://inference.broadnet.ai` without `/v1` produces 404 errors from the SDK.
-   **Doubled path.** Pasting the full endpoint, such as `.../v1/chat/completions`, as the base URL makes the SDK call `.../chat/completions/chat/completions`.
-   **Leftover environment variables.** An old `OPENAI_BASE_URL` in your shell overrides what you expect. Print it when requests go to the wrong place.
-   **Plain HTTP.** Always use `https://`. Bearer keys must travel over TLS.
-   **Changing the URL but not the model.** Each provider has its own model IDs, such as `broadnet/deepseek-v4.1-flash`.

Moving a whole app? Work through the [migration checklist](https://broadrouter.com/blog/openai-compatible-api-migration-checklist/).

## Questions

### Should the base URL end in /v1?

For OpenAI-compatible SDKs, yes, when the provider's paths start with /v1. The SDK then appends paths such as /chat/completions. Check the provider's docs for the exact value.

### Can I set the base URL without changing code?

Yes. The official OpenAI Python and Node SDKs read the OPENAI\_BASE\_URL environment variable when you do not pass a base URL. Some tools use their own variable names, such as OPENAI\_API\_BASE in Aider.

### What is the BroadNet Inference base URL?

https://inference.broadnet.ai/v1

## See also

-   [OpenAI-compatible API](https://broadrouter.com/glossary/openai-compatible-api/) (term)
-   [API key](https://broadrouter.com/glossary/api-key/) (term)
-   [LLM router](https://broadrouter.com/glossary/llm-router/) (term)
-   [Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/) (guide)
-   [Use the OpenAI Node.js SDK with BroadNet Inference](https://broadrouter.com/guides/openai-node-sdk/) (guide)
-   [Use LangChain with BroadNet Inference](https://broadrouter.com/guides/langchain-openai-base-url/) (guide)
-   [First request to BroadNet Inference with curl](https://broadrouter.com/guides/curl-quickstart/) (guide)
-   [Switching to an OpenAI-compatible API: a migration checklist](https://broadrouter.com/blog/openai-compatible-api-migration-checklist/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-base-url&utm_content=page-cta) ·

**Sources**

-   [OpenAI Python SDK README (base\_url and OPENAI\_BASE\_URL)](https://github.com/openai/openai-python)
-   [OpenAI Node SDK (baseURL, defaults to OPENAI\_BASE\_URL)](https://github.com/openai/openai-node)
-   [OpenRouter quickstart (example of a third-party base URL)](https://openrouter.ai/docs/quickstart)
-   [BroadNet Inference API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-base-url&utm_content=sources)
