Skip to main content

Copy protection

Spanway ships as ready-built container images, never as source code. The code inside the images is compiled to native machine code, so there is no program text to read. On top of that, the build strips everything that would help someone take the program apart, your license carries a fingerprint that names your deployment, and the public pages of the gateway refuse anyone who tries to copy them in bulk. Most of this works without any setup. The only thing you may want to change is the rate limit on the public pages.

A real-world scenario​

A company publishes its model catalogue and status page so customers can compare models before they sign up. A competitor points a script at /public/catalogue and /public/spanway_model_cost_map and asks for them thousands of times a minute to copy prices and traffic figures as they change. After 120 requests in a minute the gateway answers 429 Too Many Requests with a Retry-After header, so the script gets one copy a minute at most, while ordinary visitors never notice the limit. The operator sees one warning line in the log for that address and can lower the limit from the Admin UI if the script keeps coming back.

What protects the gateway image​

ProtectionWhat it means for you
Compiled code, no sourceThe image holds machine code for Spanway's own packages and no .py, .pyc or .pyi files of ours. A release check refuses any image that carries one.
No internal notes, checks or debug data inside the compiled codeThe build leaves out the notes the developers wrote inside the code for each other, the internal self-checks and the debug symbols, and it never records where the code was built. A build check stops the release when any of these is still present. The descriptions of the API routes and of their request and response fields are kept, because the API description the gateway serves is built from them and they are already published in the API reference. Command line help, such as spanwayctl --help, is kept too, because it is written out separately.
Hidden markersThe compiled code carries unique marker strings. Every week the Spanway team searches public code hosts and the web for them, so a published copy of the code is found and taken down.
A fingerprint in every licenseEvery Enterprise license carries a short fingerprint that starts with spwf and belongs to one customer. See your license fingerprint.
No source maps, docs or build details for strangersThe Admin UI ships without source maps, and anonymous callers cannot read the API description, see API docs and build details.

None of these change how the gateway behaves for your users. The compiled gateway answers the same way as any other build, and its /openapi.json and /docs pages carry the same route descriptions as the API reference. The end user license agreement also forbids taking the software apart.

Your license fingerprint​

The fingerprint is a label such as spwf3c9e1b07d2a4f6e8c1b5. It is the same for every license issued to your company, it does not reveal your company name, and it is not a secret: anyone who can read it can only tell which license it came from. The gateway shows it in two places, so a copy of either that ends up in public can be traced back to the deployment it came from:

  1. The startup log line of the license, which now ends in fingerprint=<your fingerprint>, see the log reference.

  2. The OpenAPI document the gateway serves to signed-in users, as info.x-spanway-license-fingerprint:

    curl -s http://localhost:4000/openapi.json -H "Authorization: Bearer $SPANWAY_API_KEY" | jq -r '.info["x-spanway-license-fingerprint"]'
    spwf3c9e1b07d2a4f6e8c1b5

A gateway without a license, or with a license issued before fingerprints existed, prints fingerprint=None and leaves the field out. There is nothing to set. If a fingerprint shows up somewhere it should not, for example in a public paste of your logs, the Spanway team may contact you at the address on your license.

Public feed rate limit​

The public feeds are the pages the gateway answers without a key: everything under /public/ (the model hub, the public catalogue, the price list, the status page, the release feed, the provider lists, the website assistant and leaked key reports), the skill index at /.well-known/agent-skills/index.json, the MCP registry at /v1/mcp/registry.json, the plugin marketplace at /claude-code/marketplace.json, the Cloud plans at /cloud/plans and the SSO lookup at /sso/org/discover. Each client address may send a set number of requests a minute to them, counted together. Liveness probes, model requests and the rest of the API are never counted.

SettingDefaultWhat it does in plain words
general_settings.public_route_rate_limit_per_minute120How many requests one address may send to the public feeds each minute.

What it does. The gateway counts the requests each address sends to the public feeds in the current minute. Past the limit it answers 429 with Retry-After set to the seconds left in the minute, and serves the address again when the next minute starts.

How it helps you. Nobody can copy your catalogue, prices or status history in bulk, and a script that hammers a public page cannot slow the gateway down for everyone else.

When it is on. Normal visitors and the Admin UI pages that read the AI Hub stay well under the limit. A script that reads a public page more than about twice a second gets 429 until the minute ends. Pages with their own, stricter limits, such as leaked key reports and the website assistant, keep those limits too.

When it is off. Set it to 0 and anyone can read the public pages as fast as the gateway answers.

Cost and risk. The limit costs a counter per address. The counters live in their own store, kept apart from the counters that enforce key, user and team rate limits, so a flood of visitors on the public pages can never push those out. With Redis configured the count is shared by every gateway instance, without Redis each instance counts on its own and keeps up to 10,000 addresses a minute. Browser preflight requests (OPTIONS) are never counted, and a 429 carries the same cross-origin headers as any other answer, so a website that reads a public feed from another domain can show the wait time. Many people behind one office address share one count, so a very busy office could see 429 on the AI Hub. Behind a load balancer, set trusted_proxy_ranges so each visitor's own address is counted and not the load balancer's, see sign-in security settings. When the counter cannot be reached the gateway lets the request through and logs a warning, so a cache outage never takes the public pages down.

Who should change it. A proxy admin who publishes the public pages. Lower it if a scraper keeps coming back, raise it if real traffic from a shared address hits it.

Change the limit​

  1. In the Admin UI, open Status Page in the left menu and scroll to Public surfaces.
  2. In the Public feed rate limit card, type the new number in Requests per address per minute. 0 turns the limit off.
  3. Click Save public feed rate limit settings. The new limit applies at once, no restart needed.

Or through the API:

curl -X POST http://localhost:4000/config/field/update \
-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
-d '{"config_type": "general_settings", "field_name": "public_route_rate_limit_per_minute", "field_value": 60}'

Or in the config file:

general_settings:
public_route_rate_limit_per_minute: 60

The change is written to the audit log like every other general setting change, with object_id general_settings, see audit logs.

Check it​

Send more requests than the limit from one address and look at the last answer:

for i in $(seq 1 121); do curl -s -o /dev/null -w "%{http_code}\n" http://localhost:4000/public/whats_new; done | sort | uniq -c
120 200
1 429

The refused answer looks like this:

HTTP/1.1 429 Too Many Requests
retry-after: 37
content-type: application/json

{"detail":"Too many requests to public pages from this address, try again in 37 seconds"}

Errors​

StatusMessageCauseFix
429Too many requests to public pages from this address, try again in <n> secondsOne address sent more than public_route_rate_limit_per_minute requests to the public feeds this minute.Wait the Retry-After seconds. If the traffic is real, raise the limit, or set trusted_proxy_ranges when every visitor shares the load balancer's address.
403User can only create keys for themselves. Got user_id=<id>, Your ID=<id>A user who is not a proxy admin asked /key/generate or /key/update for a key owned by someone else.Ask a proxy admin to create the key, or create it for yourself.

See the error reference for every other 429.

Logs​

LevelLineMeaningAction
WARNINGSpanway public route rate limit: answered 429 to <method> <path> because one address sent more than <n> requests this minute. Raise general_settings.public_route_rate_limit_per_minute if this is expected traffic.The first refusal for an address in a minute. Later refusals in the same minute are counted, not logged. The address is never logged.None for a scraper. If your own tool or office causes it, raise the limit.
WARNINGSpanway public route rate limit: the request counter is unreachable, letting the request through (<error type>)The gateway cache did not answer, so the request was served without counting it.Check the cache or Redis connection, see health.
INFOLicense configured=<true or false> valid=<true or false> expires=<date> features=<n> fingerprint=<fingerprint>The license line at startup and on the hourly re-check, now with the license fingerprint.None.

The gateway also counts refusals in the Prometheus counter spanway_public_route_throttled_requests_total, see Prometheus metrics.