Guide · NewAPI
Connecting to NewAPI
NewAPI is an open-source OpenAI-compatible relay that puts many channels' models behind one
address. This app ships a built-in NewAPI provider: text goes to
/chat/completions, images go to /images/generations, and it reads the
gateway's public endpoint metadata to sort models into the Text and Image tabs
automatically.
1. How it connects
Settings → Models → Add model provider → pick NewAPI: enter your gateway address and NewAPI token. There is no endpoint type to choose.
| Scenario | API Base URL | API Key |
|---|---|---|
| Hosted NewAPI | https://your-newapi.example.com/v1 |
Required (a NewAPI token starting with sk-) |
| Self-hosted NewAPI | http://127.0.0.1:3000/v1 |
Required (same) |
/v1 yourself. The app only strips a
trailing slash; it never appends /v1 for you. Enter
https://your-newapi.example.com/v1 and requests go to
https://your-newapi.example.com/v1/chat/completions. If NewAPI lives under a sub-path, put the
sub-path in too, e.g. https://your-newapi.example.com/gateway/v1.
| Capability | Actual request | Model catalog |
|---|---|---|
| Text | POST {Base URL}/chat/completions |
Fetched from GET {Base URL}/models; image-capable models never show up here
|
| Image |
POST {Base URL}/images/generations; with a reference image,
POST {Base URL}/images/edits (multipart, one image max)
|
Listed automatically from the gateway's endpoint metadata; falls back to id-name heuristics when metadata is unavailable, and you can still add ids by hand |
The endpoint metadata comes from the gateway's public GET /api/pricing, which carries
an endpoint dictionary mapping endpoint types to real paths:
{
"image-generation": { "path": "/v1/images/generations" },
"image-edit": { "path": "/v1/images/edits" },
"openai": { "path": "/v1/chat/completions" }
}
Each model entry also carries supported_endpoint_types, so “can this model
generate images” does not rely on guessing names (even something like
grok-imagine-image is detected). The list of models still comes from the
token-visible /v1/models — metadata only decides modality and endpoint,
it never adds models your token cannot use.
2. Prepare three things on the NewAPI side
-
The site address: the domain you normally open the NewAPI panel on (this guide
uses
https://your-newapi.example.comas a placeholder — substitute your own site). Its OpenAI-compatible entry point is/v1, so the Base URL ishttps://your-newapi.example.com/v1. -
A token: NewAPI panel → Tokens → add a token, then
copy the string starting with
sk-. The token's group decides which models you can use — this is the easiest trap:The catalog the app fetches isGET /v1/models, which only lists models available to your token's group; the panel's price list (/pricing,GET /api/pricing) lists every group on the site, so the two counts often differ.
Typical: the price list has 13 models while the token catalog has 3 — the other 10 sit in other groups (such asGPT-Image-4K,Nano Banana,Grok-imagine-image) and calling them with this token returns 503:No available channel for model … under group GPT-Image.
To use those models, switch the token to a group that covers them, or create a token for that group. -
Model names: NewAPI panel → Channels / Models, and note
the exact model ids you want (such as
gpt-4o-mini,deepseek-chat,flux.1-schnell,gpt-image-2.5-flare). When typing a model by hand it must match character for character, including case and hyphens.
Before filling anything into the app, confirm these endpoints work from a shell:
# model list (token-visible catalog + auth check)
curl -H "Authorization: Bearer sk-YOUR-TOKEN" https://your-newapi.example.com/v1/models
# text completion
curl -X POST https://your-newapi.example.com/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR-TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'
# image generation (use an image model id from your catalog)
curl -X POST https://your-newapi.example.com/v1/images/generations \
-H "Authorization: Bearer sk-YOUR-TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-image-2.5-flare","prompt":"a red ball","n":1}'
3. Add the NewAPI provider in this app
- Open Settings → Models (models and keys are global, shared by every project).
- In the “Add model provider” dropdown pick NewAPI, then click Add. The new card expands and scrolls into view automatically.
-
Display name: the default
NewAPIis fine, or rename it to your site. -
API Base URL: replace the placeholder with your own gateway, e.g.
https://your-newapi.example.com/v1(see the reminder in section 1). - API Key: paste the NewAPI token. The eye button reveals it temporarily so you can double-check.
- Tick Enabled — a disabled provider never shows up in any node's model dropdown.
4. Fetch text models
- Switch to the Text tab.
- Click Fetch available models. The button briefly reads “Verifying API key…” — that step doubles as the key and connectivity check.
- On success the count appears next to the button. The list is filtered by modality: image-capable models are sorted into the Image tab and never show up here.
- Use the filter box and “Select all in list” / “Clear selection”, then tick your models.
- To pin a default, pick one in the Default generation model dropdown (it lists only the ticked models).
Editing a generation node now shows NewAPI · model name in the model dropdown. If the
dropdown is empty the inspector says “configure an available text model in settings first (an
API key plus at least one ticked model)” — come back to this step.
5. Adding models by hand (the important part)
Every provider card has a free-text field labelled “Model / endpoint / Resource ID (type it in)” with an “Add & select” button next to it (Enter works too). Type an id, click the button, and the model joins the current tab's list already ticked; the field clears itself afterwards.
5.1 When you have to type it by hand
- Image models usually need no hand-typing. Fetching reads the gateway's endpoint metadata and puts image-capable models on the Image tab (see section 1). You only type them when that metadata is unavailable or when an id gives no hint of being an image model — hand-typed entries merge into the same list as fetched ones.
-
Fetching returns 404 / 405: the gateway does not implement
/models. The list comes back empty without an error (expected). Type the ids instead — generation is unaffected. - “All N models returned by the endpoint are image-generation models”: the token's group only has image channels, so the Text tab has nothing to show — tick them on the Image tab, or switch the token to a group that includes chat channels.
- Fetching reports “the gateway returned no models”: the address or token is wrong, or the token is not bound to any channel.
- You only want a few: skip scrolling through hundreds of models and type the ids you need.
- A model was renamed on NewAPI: type the new id; un-tick the stale entry.
5.2 Typing a text model
- Stay on the Text tab.
-
Type the exact model id from NewAPI into the “model / endpoint /
Resource ID” field, for example
deepseek-chat. - Click Add & select (or press Enter).
- Optionally set it as the default in “Default generation model”.
5.3 Typing an image model
- Switch to the Image tab and click Fetch available models once — normally the image-capable models are listed right away (the image catalog is picked by gateway endpoint metadata, not hard-wired to be empty).
-
For anything not listed, type the image model id into the field, for example
gpt-image-2.5-flareorflux.1-schnell. Use a name that really exists on NewAPI — not a description such as “image model”. - Click Add & select.
- Make it the default in the “Default generation model” dropdown (ticked entries only).
5.4 Are hand-typed entries ever overwritten?
- No. When you fetch again, models that are ticked but absent from the remote catalog are kept and added back to the list (an occasionally empty remote list also keeps the previous result).
- Duplicate ids are not added twice — an id already in the list is simply re-ticked.
- Only ticked models are persisted. Ticking writes them into the settings file; un-ticking removes the model together with its capability snapshot.
- Only ticked models can be picked in nodes. A node's dropdown lists ticked entries only; if a model id reaches a node by another route (MCP, a template, an older project) without being ticked here, execution silently falls back to the default model or the first ticked one.
6. Using it in nodes
-
Text generation node: pick
NewAPI · your text modelin the model dropdown, write an instruction, run it. -
Image generation node: pick
NewAPI · your image model. To use a reference image, wire an image into that node's image input — with a reference present the request switches to/images/edits. -
Resolution and quality: the request carries
size/quality/nwhen applicable;sizeis sent only when it maps to1024x1024 / 1536x1024 / 1024x1536, otherwise it is omitted. Some relayed models accept only their own sizes — when a request fails, check the actual request in the run log first. - Progress and failure reasons live in the run log; authentication failures come with “check that the API key in settings is correct and saved, and that the provider Base URL matches”.
7. FAQ
- “Fetch available models” is greyed out: the NewAPI provider needs a token before that button enables. Fill in the token (and make sure Enabled is ticked).
- “Invalid API key, model fetching blocked: …”: the key was copied wrong, the token is disabled or expired, or its group is not allowed for this request.
- “Connection test failed: code=ENOTFOUND …”: the domain does not resolve — a typo, or a local network or proxy problem. A domain that opens in a browser is not proof: the app connects from the main process and does not use system proxy settings.
-
Fetching returns 404 / 405, or an empty list: the gateway has no
/models. Type the model ids as in section 5; generation still works. -
The panel price list shows a dozen models but the app only fetches a few: the app
reads
GET /v1/models, which only lists models available to your token's group; the panel price list covers every group on the site. Switch the token's group (see section 2) to reach the others. -
Fetching or generating returns 503 /
No available channel: that model has no usable channel under your token's group — not a bug in the app. Switch groups, or use another model in the same group. - The Text tab has no models at all while Image does: the token's group only has image channels. That is expected, and the app says so: “all models returned are image-generation models”.
- The Image tab fetch says “the remote returned an empty list; the previous result was kept”: the gateway catalog held no classifiable image model. Type the id by hand — not a failure, and your entry stays.
- Generation fails with “video generation / speech synthesis / 3D model generation is not supported yet”: the NewAPI provider only does text and images. For video use a built-in video provider or ComfyUI (see the ComfyUI guide).
-
Classic wrong-Base-URL symptoms: omitting
/v1, or including/chat/completionsas well, both end in 404. -
Model name does not match: always copy the id shown in the NewAPI panel and
check it character by character; relays often add prefixes or suffixes such as
-free,-thinkingor-4k. -
Where is the API key stored: in the local settings file (on Windows, for
example,
%APPDATA%\AIArtEngine\aiartengine-settings.json), in plain text. It is never uploaded to the app's own servers, but do take care of that file on this machine.
Further reading: NewAPI docs · Manual · Settings.