Skip to content
nsin docs

Using a Gateway

Every gateway gives you a hostname on your own domain. Point whatever you were pointing at the service, at that instead.

The dashboard’s How to use dialog gives exact lines per gateway — this page covers the shapes they take. Swap in your own hostname.

Most SDKs take a base URL — that’s all you change.

import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://ai-40218.example.ir/v1',
apiKey: process.env.OPENAI_API_KEY,
});
from anthropic import Anthropic
client = Anthropic(
base_url="https://claude-18830.example.ir",
api_key=os.environ["ANTHROPIC_API_KEY"],
)

Streaming passes through as it arrives, unbuffered.

stream: true responses reach you chunk by chunk. WebSocket upgrades — realtime and voice — pass through too.

The edge only limits the wait for the upstream’s first byte: five minutes on a gateway. Once a stream starts, it can run as long as it likes.

A non-streaming call must finish within those five minutes. A 504 on a long request without stream: true means: turn on streaming.

For a plain HTTP call, just swap the host:

Terminal window
GW=https://tg-60412.example.ir
curl -s "$GW/bot$TOKEN/sendMessage" \
-d chat_id=$CHAT_ID \
-d text='deploy finished'

These take a registry or index URL, not a base URL.

Terminal window
npm config set registry https://npm-51074.example.ir/

Per project, in an .npmrc beside package.json:

registry=https://npm-51074.example.ir/

pnpm: same command. Yarn 2+: npmRegistryServer in .yarnrc.yml.

Keep the /simple/ path — it’s the index API, not a website path.

Terminal window
pip config set global.index-url https://pypi-33915.example.ir/simple/
# pyproject.toml, for uv
[[tool.uv.index]]
name = "nsin"
url = "https://pypi-33915.example.ir/simple/"
default = true

The hostname becomes the registry prefix of the image name:

Terminal window
docker pull docker-77228.example.ir/library/nginx:latest
docker pull docker-77228.example.ir/grafana/grafana:latest

A registry often answers with a redirect to another host: Docker Hub to its blob CDN and auth service, PyPI’s index to files.pythonhosted.org, crates.io to static.crates.io, NuGet’s index to api.nuget.org. A plain proxy breaks there — the client can’t reach that host.

nsin rewrites those links to a prefix on your own gateway hostname:

https://docker-77228.example.ir/_nsin/auth.docker.io/token?service=…

The real host still gets the real path, so signed URLs validate and range requests and resumes still work. No setup needed — the allowlist ships with the preset.

The generated name is <service>-<5 digits>. Rename it in the dashboard — models, registry, push — and update your config, since the hostname changes.

It can’t be a wildcard, and can’t be the domain apex.

Everything returns 403 and the panel shows a quota bar at 100%. You’ve passed the plan’s rolling 30-day ceiling. Only the gateway hostnames are blocked — usage ages out, or raise the ceiling with a plan change. See What Are Gateways?.

A docker pull or pip install starts, then fails partway. Check the path: library/ for Docker Hub official images, /simple/ for PyPI. Still breaking? Send us the command — a new preset may need another allowlisted host.

The provider rejected my credentials or locked the account. Providers see gateway traffic from shared nsin egress addresses. See Shared egress addresses.

The page says gateways aren’t on this domain’s plan. See Plans & Limits.

The Gateways page says the domain uses external DNS. A gateway is a record on your zone, so nsin has to run your DNS. See Nameservers.