LobeChat custom OpenAI API setup: Base URL, API key, and model

Configure LobeChat or LobeHub with a custom OpenAI-compatible API. Use RutaAPI's Base URL, API key, and enabled model ID to get started.

Start with RutaAPI

Create an API key — includes $1 trial credit, then use https://api.rutaapi.com/v1 as the Base URL in LobeChat.

Create API key View model pricing
Quick answer

To use RutaAPI with LobeChat, set OPENAI_API_KEY to your RutaAPI API key and set OPENAI_PROXY_URL to https://api.rutaapi.com/v1 when your deployment expects an OpenAI-compatible /v1 endpoint. The API key and proxy URL must come from the same provider. If you see empty responses or model errors, verify /v1/models and confirm whether your LobeChat deployment expects the /v1 suffix.

Before you start

You need a RutaAPI account, a prepaid credit pack, and an API key. Make sure your account has credits before making requests — requests without sufficient credits will return a 401 or 403 error.

What LobeChat asks for LobeChat / LobeHub supports adding custom OpenAI-compatible model providers. Configuration typically involves OPENAI_API_KEY (your API key) and OPENAI_PROXY_URL (the request base URL). Both values must belong to the same provider — using a key from one platform with a URL from another will result in errors.

What OPENAI_API_KEY means OPENAI_API_KEY is the environment variable that stores your API key. LobeChat uses this to authenticate requests to the model provider. Enter your RutaAPI API key in this field — it identifies your account and must match the proxy URL.

What OPENAI_PROXY_URL means OPENAI_PROXY_URL is the environment variable that tells LobeChat where to send API requests. The correct RutaAPI proxy URL is <strong>https://api.rutaapi.com/v1</strong>. This is the OpenAI-compatible API root — it includes /v1 and points to the API gateway, not the marketing site or dashboard.

Should OPENAI_PROXY_URL include /v1? LobeHub documentation notes that whether to include /v1 depends on the model service provider. For RutaAPI OpenAI-compatible usage, use https://api.rutaapi.com/v1. Do not remove /v1 unless a specific deployment layer already appends it. If you see empty responses, double-check whether your LobeChat deployment adds /v1 automatically.

What model name means The model name is the identifier of the AI model that handles your request. It must match one of the models returned by GET /v1/models for your account. Do not guess — identifiers differ between providers.

LobeChat version caveat LobeChat / LobeHub configuration can vary by version, deployment mode, environment variables and feature flags. Official LobeHub documentation describes OPENAI_API_KEY and OPENAI_PROXY_URL, and notes that whether to include /v1 depends on the provider. Users should verify their deployed version and hosting environment before relying on a specific setup.

RutaAPI disclaimer RutaAPI is an OpenAI-compatible API gateway. It is not an official LobeChat, LobeHub, OpenAI, Anthropic, Google or Microsoft service. Model availability and rates depend on your account configuration and upstream providers.

How to start with RutaAPI

Step 1 — Create a RutaAPI account

Register at app.rutaapi.com. No credit card is required to sign up.

Step 2 — Add prepaid credits

Purchase a credit pack from the billing section. Credits are added immediately after payment. Requests without sufficient credits return 401 or 403.

Step 3 — Create an API key

Go to the Tokens section and create a new key. Copy it right away — it is shown only once at creation.

Security: Never paste your full API key into screenshots or shared scripts. If exposed, rotate it immediately from the dashboard.

Step 4 — Verify /v1/models

Before configuring LobeChat, confirm the key works by calling /v1/models:

A 200 response with a model list means the key is valid. A 401 response means the key is wrong or revoked.

curl https://api.rutaapi.com/v1/models \
  -H "Authorization: Bearer YOUR_RUTAAPI_KEY"

Step 5 — Set environment variables

Set the following environment variables in your LobeChat deployment. Exact deployment files vary — some use .env, Docker variables, Vercel variables or provider settings.

Some LobeChat deployments may use environment variables, Docker variables, Vercel variables or provider settings. After changing environment variables, restart or redeploy the service.

OPENAI_API_KEY=YOUR_RUTAAPI_KEY
OPENAI_PROXY_URL=https://api.rutaapi.com/v1

Step 6 — Restart or redeploy LobeChat

After changing OPENAI_API_KEY, OPENAI_PROXY_URL or other environment variables, restart or redeploy the LobeChat service for the new values to take effect.

This applies to Docker, Vercel, Railway, Render and most other hosting platforms. Without a restart, LobeChat may continue using cached configuration.

Step 7 — Send a small test request

Before starting a chat session, confirm end-to-end connectivity from the terminal:

A successful response confirms the key, proxy URL, model name and credits are all working correctly.

curl https://api.rutaapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_RUTAAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_ENABLED_MODEL_ID",
    "messages": [
      {"role": "user", "content": "Hello from RutaAPI"}
    ]
  }'

Who this guide is for

This guide is for LobeChat / LobeHub users who want to connect their self-hosted chat interface to an OpenAI-compatible API gateway provided by RutaAPI.

It helps if you are familiar with environment variables, .env files, Docker or Vercel deployments.

Who should not use this setup

Testing before you start chatting

Before starting a chat session in LobeChat, send a simple request from the terminal to confirm your key, proxy URL and model name all work together. This rules out configuration issues before you begin.

If the first request succeeds, the LobeChat configuration should also work. If it fails, fix the terminal request first — that gives you clearer error messages than the LobeChat UI.

How to pick a model name

Model names are returned by the GET /v1/models endpoint. Copy one of the model id values from the response and use it as the model name in your LobeChat settings.

Model availability is per-account. If a model name is not in your /v1/models response, it is not active in your account — add more credits or contact support.

Common mistakes

Empty response troubleshooting

If LobeChat returns an empty response, the most common causes are:

Run /v1/models to verify the model ID, and check whether your LobeChat deployment adds /v1 automatically.

Common errors

401 Unauthorized / invalid API key

The API key is missing, incorrect, or sent to the wrong URL. Verify OPENAI_API_KEY and OPENAI_PROXY_URL both come from RutaAPI. Run /v1/models to confirm the key is valid.

403 Forbidden

The key exists but lacks permission. Check credits and model access in your RutaAPI account.

404 Model not found

The model name is not in your account. Run GET /v1/models and copy a returned model id.

429 Too Many Requests

Rate or concurrency limit. Lower the number of concurrent requests and retry.

503 Service Unavailable

The provider route is temporarily unavailable. Try a short request, check model availability, contact support if persistent.

Empty response

Usually caused by a proxy URL suffix mismatch or model name not matching /v1/models. Check whether /v1 is required and verify the model ID is in /v1/models.

When RutaAPI may be a good fit

When RutaAPI may not be the right fit

Related setup and troubleshooting guides

Ready to test RutaAPI? Use one OpenAI-compatible base URL, prepaid credits, and API keys from the dashboard.

FAQ

What OPENAI_PROXY_URL should I use for RutaAPI in LobeChat?

Use https://api.rutaapi.com/v1 — the /v1 path is the OpenAI-compatible API root. Do not use https://rutaapi.com, https://app.rutaapi.com, or any path ending in /chat/completions.

Should OPENAI_PROXY_URL include /v1?

LobeHub documentation notes that whether to include /v1 depends on the provider. For RutaAPI, use https://api.rutaapi.com/v1. If LobeChat returns empty responses or 404 errors, check whether your deployment adds /v1 automatically — you may need to omit it if the deployment layer already appends it.

Can I use https://rutaapi.com as OPENAI_PROXY_URL?

No. https://rutaapi.com is the marketing site, not the API root. Using it as OPENAI_PROXY_URL will result in errors. Always use https://api.rutaapi.com/v1.

Can I use https://app.rutaapi.com as OPENAI_PROXY_URL?

No. https://app.rutaapi.com is for account management, not the API. Using it as OPENAI_PROXY_URL will result in errors. Always use https://api.rutaapi.com/v1.

Where do I get my RutaAPI API key?

Create one from the RutaAPI dashboard at https://app.rutaapi.com in the Tokens section. Keys are shown only once at creation — copy and store them securely.

How do I know which enabled model ID to use?

Run GET /v1/models with your API key and use one of the model id values from the response. Do not guess — identifiers differ between providers.

Why does LobeChat return an empty response?

An empty response usually means the proxy URL suffix or model name does not match. Check whether OPENAI_PROXY_URL includes /v1 when required by your deployment. Also verify the model name is an exact ID from /v1/models and that your account has sufficient credits.

Can a missing /v1 cause empty responses?

Yes. If OPENAI_PROXY_URL is set to https://api.rutaapi.com without /v1, but your LobeChat deployment does not append /v1 automatically, the request may route to a non-API endpoint and return empty content. Verify what your deployment expects and adjust accordingly.

Can a wrong proxy URL cause 401?

Yes. If OPENAI_PROXY_URL belongs to a different provider than the API key, the provider rejects the key with 401. Both OPENAI_API_KEY and OPENAI_PROXY_URL must come from the same platform.

What does 403 mean?

HTTP 403 means the key exists but lacks permission. Check that your account has enough prepaid credits and that the model is enabled in your account.

What does 404 model not found mean?

HTTP 404 means the model name is not recognised at that endpoint. Run /v1/models and use one of the returned model id values as the model name. Do not guess.

What does 429 mean?

HTTP 429 means you have hit a rate or concurrency limit. Lower the number of concurrent requests, pause parallel tasks and retry after a short pause.

What does 503 mean?

HTTP 503 means the provider route is temporarily unavailable. Try a short request, check model availability, and contact support if the issue persists.

Do I need to restart or redeploy after changing environment variables?

Yes. After changing OPENAI_API_KEY, OPENAI_PROXY_URL or other environment variables, you typically need to restart or redeploy the LobeChat service for the new values to take effect. This applies to Docker, Vercel, Railway, Render and most other hosting platforms.

Is RutaAPI an official LobeChat or OpenAI service?

No. RutaAPI is an OpenAI-compatible API gateway operated by BDR FIDUCIARY LLC. It is not an official service of LobeChat, LobeHub, OpenAI, Anthropic, Google or Microsoft.

Can RutaAPI guarantee LobeChat compatibility?

No. LobeChat / LobeHub configuration, environment variable names, proxy URL behaviour and deployment options can vary across versions, deployment modes and hosting platforms. RutaAPI cannot guarantee compatibility with every LobeChat version or deployment mode.

Should I paste my API key into screenshots?

No. Never share your full API key in screenshots, forum posts, GitHub issues or any public or shared channel. If exposed, rotate it immediately from the dashboard.

What should I send to support?

Include: request time (UTC), model name, error code, proxy URL, any request ID from response headers, and approximate request size. Do not share your full API key. Describe the key prefix if needed.