To use RutaAPI with NextChat, set the API key to a RutaAPI API key and set the Base URL to https://api.rutaapi.com/v1 if your NextChat deployment expects an OpenAI-compatible /v1 endpoint. The API key and Base URL must come from the same provider. Do not use the RutaAPI website URL, dashboard URL, pricing page, registration page or a full chat completions endpoint as the Base URL.
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 NextChat asks for NextChat / ChatGPT Next Web typically asks for an API key and a Base URL. Most deployments use OPENAI_API_KEY and BASE_URL environment variables. Both values must belong to the same provider — using a key from one platform with a Base URL from another will result in a 401 error.
What OPENAI_API_KEY means OPENAI_API_KEY is the environment variable that stores your API key. NextChat uses this to authenticate requests. Enter your RutaAPI API key in this field — it identifies your account and must match the Base URL.
What BASE_URL means BASE_URL is the environment variable that tells NextChat where to send API requests. The correct RutaAPI Base 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.
What the model name is 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.
NextChat version caveat NextChat / ChatGPT Next Web configuration can vary by deployment method, environment variables, version and hosting platform. Public NextChat documentation and repository examples describe OPENAI_API_KEY and BASE_URL, but users should verify their own deployed version and environment variable names before relying on a specific setup.
RutaAPI disclaimer RutaAPI is an OpenAI-compatible API gateway. It is not an official NextChat, ChatGPT Next Web, 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 NextChat, 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 — Copy a returned model name
Use one of the model id values (YOUR_ENABLED_MODEL_ID) from the /v1/models response as the model identifier. Do not guess — identifiers differ between providers.
Run /v1/models and copy the exact id string. The model name in NextChat must match one of the returned model identifiers.
Step 6 — Configure NextChat
Set the following environment variables in your NextChat deployment. Exact deployment files vary — some use .env, Docker environment variables, Vercel environment variables or hosting dashboard settings.
Do not promise exact UI labels or hosting platform steps because NextChat deployments vary by version and fork. After changing environment variables, redeploy or restart the NextChat service.
OPENAI_API_KEY=YOUR_RUTAAPI_KEY
BASE_URL=https://api.rutaapi.com/v1Step 7 — Send a small test request
Before using NextChat, send a simple request from the terminal to confirm end-to-end connectivity:
A successful response confirms the key, Base 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 NextChat / ChatGPT Next Web 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
- Users whose NextChat version or fork does not support custom BASE_URL.
- Users whose hosting platform does not support custom environment variables.
- Users who require official OpenAI-only features.
Testing before you start chatting
Before using NextChat, send a simple request from the terminal to confirm your key, Base URL and model name all work together. This rules out configuration issues before you start a real session.
If the first request succeeds, the NextChat configuration should also work. If it fails, fix the terminal request first — that gives you clearer error messages than the NextChat 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 NextChat 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
- Using https://rutaapi.com as BASE_URL — that is the marketing site, not the API root.
- Using https://app.rutaapi.com as BASE_URL — that is for account management, not the API.
- Using https://api.rutaapi.com without /v1 when the deployment expects an OpenAI-compatible /v1 endpoint.
- Pasting https://api.rutaapi.com/v1/chat/completions as BASE_URL — that is an endpoint, not the root.
- Setting a RutaAPI key but keeping another provider's BASE_URL.
- Setting BASE_URL correctly but using an API key from another platform.
- Guessing model names instead of using /v1/models.
- Forgetting to redeploy or restart the NextChat service after changing environment variables.
- Exposing API keys in screenshots or public repositories.
Common errors
401 Unauthorized / invalid API key
The API key is missing, incorrect, or sent to the wrong Base URL. Verify OPENAI_API_KEY and BASE_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.
When RutaAPI may be a good fit
- You need an OpenAI-compatible Base URL for NextChat
- You want dashboard-generated API keys
- You want prepaid credits
- You want to verify available models with /v1/models
- You need docs for NextChat, Cursor, Cline, Continue.dev, Codex CLI and Claude Code
- You want usage visibility before scaling
When RutaAPI may not be the right fit
- Your NextChat deployment does not support custom BASE_URL
- Your hosting platform did not apply the environment variables
- The selected model is unavailable upstream
- Your API key belongs to another provider
- You require official OpenAI-only features
Related setup and troubleshooting guides
- API Key and Base URL explained
- Unified Base URL for AI coding tools
- Cursor custom API setup guide
- Cline OpenAI-compatible API setup
- Continue.dev OpenAI-compatible API setup
- Codex CLI setup with RutaAPI
- Claude Code setup with RutaAPI
- Codex CLI invalid_api_key troubleshooting
- Claude Code timeout troubleshooting
- Available models
- Pricing and credit packs
FAQ
What Base URL should I use for RutaAPI in NextChat?
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 the NextChat BASE_URL include /v1?
Yes, if your NextChat deployment expects an OpenAI-compatible /v1 endpoint. The correct BASE_URL is https://api.rutaapi.com/v1. Without /v1, you are pointing to the wrong endpoint.
Can I use https://rutaapi.com as BASE_URL?
No. https://rutaapi.com is the marketing site, not the API root. Using it as BASE_URL will result in errors. Always use https://api.rutaapi.com/v1.
Can I use https://app.rutaapi.com as BASE_URL?
No. https://app.rutaapi.com is for account management, not the API. Using it as BASE_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.
Should I set OPENAI_API_KEY or another key name?
Most NextChat deployments use OPENAI_API_KEY. Check your deployed version and hosting platform to confirm the exact environment variable name. Some forks or older versions may use different names.
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 as the model name. Do not guess — identifiers differ between providers.
Why does NextChat show invalid API key?
An invalid_api_key or 401 error usually means the API key does not match the Base URL, or it was sent to the wrong endpoint. Verify that both OPENAI_API_KEY and BASE_URL come from the same platform. Run /v1/models to confirm the key is valid.
Can a wrong BASE_URL cause 401?
Yes. If BASE_URL belongs to a different provider than the API key, the provider rejects the key with 401. Both OPENAI_API_KEY and BASE_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 redeploy after changing environment variables?
Yes. After changing OPENAI_API_KEY, BASE_URL or other environment variables, you typically need to redeploy or restart the NextChat service for the new values to take effect. This applies to Docker, Vercel, Railway, Render and most other hosting platforms.
Is RutaAPI an official NextChat or OpenAI service?
No. RutaAPI is an OpenAI-compatible API gateway operated by BDR FIDUCIARY LLC. It is not an official service of NextChat, ChatGPT Next Web, OpenAI, Anthropic, Google or Microsoft.
Can RutaAPI guarantee NextChat compatibility?
No. NextChat configuration, environment variables, BASE_URL support and deployment options can vary across versions, forks and hosting platforms. RutaAPI cannot guarantee compatibility with every NextChat version, fork or deployment method. Verify the current NextChat documentation for your installed version.
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, Base URL, any request ID from response headers, and approximate request size. Do not share your full API key. Describe the key prefix if needed.