---
title: "Deploy Chronos | (Just Updated) Time-Series Forecasting API, Zero-Shot Quantile Forecasts, API Key Pre-Set"
description: "Amazon Chronos-2 time-series forecasting API, zero-shot quantiles, CPU"
category: "AI/ML"
url: https://railway.com/deploy/chronos-or-just-updated-time-series-fore
---

# Deploy Chronos | (Just Updated) Time-Series Forecasting API, Zero-Shot Quantile Forecasts, API Key Pre-Set

Amazon Chronos-2 time-series forecasting API, zero-shot quantiles, CPU

**[Deploy Chronos | (Just Updated) Time-Series Forecasting API, Zero-Shot Quantile Forecasts, API Key Pre-Set on Railway](https://railway.com/template/chronos-or-just-updated-time-series-fore)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/chronos-or-just-updated-time-series-fore/manifest.json

- **Creator:** SuperSlowSloth
- **Category:** AI/ML

## Template content

### chronos

- **Image:** ghcr.io/bon5co/chronos-railway:1.0.1@sha256:79e2245763a7e97a8314a2787ccb3752fe9fb8e53a76d232d27aa9d3cedb4d56
- **Health check:** /health
- **Public domain:** Yes

## Documentation

# Deploy and Host Chronos Time-Series Forecasting API on Railway

Amazon Chronos-2 is an open pretrained time-series foundation model: it forecasts a series it has never seen, with no training and no per-series fitting, and returns quantiles instead of one number. This template serves Chronos-2 and the two Chronos-Bolt sizes behind one authenticated JSON API: post a history, get back a median and quantile forecast, optionally with past and future covariates. The weights are already inside the image, an API key is generated for you at deploy, and everything runs on CPU.

## About Hosting Chronos

This template runs `chronos-forecasting` 2.3.2 (Amazon Science, the newest release at build time) with PyTorch on CPU behind a small FastAPI server. `POST /v1/forecast` takes `series` (each with `values`, oldest first, `null` for a gap), `prediction_length`, and optionally `quantiles`, `model` (`chronos-2`, `chronos-bolt-small` or `chronos-bolt-base`), `start` plus `freq` for timestamps, and, for Chronos-2, `past_covariates`, `future_covariates` and `cross_learning`. The response carries `median`, a `quantiles` map and `timestamps` per series. `GET /v1/models` lists the models. Chronos-Bolt forecasts at most 64 steps and answers `422` above that; Chronos-2 forecasts up to 1024.

The weights are baked into the image, so the first request is answered from disk and no model download hides inside a request that Railway's edge would abandon after five minutes. The service sizes its PyTorch thread pool from the container's own CPU quota instead of the host's core count, handles one request at a time so memory stays bounded, and caps one request at 2,000,000 values in total.

**Measured on Railway, 8 vCPU, 8 GB container, Chronos-2 unless stated:** one series of 512 points and a 24-step horizon took **0.06 s** (Chronos-Bolt small 0.09 s, Bolt base 0.17 s); 20 series of 1000 points took **0.53 s**; 100 series of 2000 points and a 96-step horizon took **6.5 s**; 256 series of 4000 points and a 256-step horizon took **35.3 s**; and the largest request the service accepts, 100 series of 20,000 points (2.0 million values), took **26.8 s**. Every one finished far inside the five minute edge limit. The model loads in about 3.5 s after the container starts, and the process peak resident memory after those requests read **4.5 GB** (`peak_rss_mb` on `/health`).

### Agent contract

- Public URL: `https://RAILWAY_PUBLIC_DOMAIN` (the generated domain of the `chronos` service)
- Private URL: `http://chronos.railway.internal:8080`
- Credentials: the `API_KEY` variable of the `chronos` service
- Auth: send `Authorization: Bearer $API_KEY` on every route except `GET /health`; a call without the key or with a wrong one answers `401`
- Health: `GET /health` returns 200 once the model is loaded (503 while it loads)

```bash
# needs: RAILWAY_PUBLIC_DOMAIN, API_KEY (a variable of the chronos service); also curl.
# signup: none - the API has no user accounts, only the API_KEY bearer
R="https://$RAILWAY_PUBLIC_DOMAIN"
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/health"
# 8 weeks of a sales-like weekly pattern: 10, 20 ... 70, repeated
V="10,20,30,40,50,60,70"; for w in 1 2 3 4 5 6 7; do V="$V,10,20,30,40,50,60,70"; done
B="{\"series\":[{\"id\":\"sales\",\"values\":[$V]}],\"prediction_length\":7}"
curl -s -o /dev/null -w "write without key: %{http_code}\n" -X POST "$R/v1/forecast" -H "Content-Type: application/json" -d "$B"
curl -s -o /dev/null -w "write wrong key: %{http_code}\n" -X POST "$R/v1/forecast" -H "Content-Type: application/json" -H "Authorization: Bearer not-the-key" -d "$B"
curl -s -X POST "$R/v1/forecast" -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" -d "$B" \
  | grep -o '"median":\[[^]]*\]' | head -1
```

A fresh deploy prints `health: 200`, `write without key: 401`, `write wrong key: 401` and a `"median"` list close to `10, 20, 30, 40, 50, 60, 70`, the weekly pattern continued (the last run printed `8.77, 19.67, 30.29, 40.81, 50.31, 59.91, 68.77`). To forecast with a known-in-advance covariate such as a promotion calendar, and to label the output with dates:

```bash
curl -X POST "https://$RAILWAY_PUBLIC_DOMAIN/v1/forecast" \
  -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
  -d '{"series":[{"id":"store-1","values":[...],"past_covariates":{"promo":[...]},"future_covariates":{"promo":[...]}}],
       "prediction_length":14,"start":"2026-11-20","freq":"D","quantiles":[0.1,0.5,0.9]}'
```

`start` is the timestamp of the last history point. `past_covariates` have the same length as `values`; `future_covariates` have `prediction_length` values and must also appear in `past_covariates`. A malformed request answers `422` with the reason, and a body over `MAX_BODY_MB` answers `413`.

## Why Deploy Chronos Time-Series Forecasting API on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Chronos on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

- **No training step** — a zero-shot model forecasts a new series from its history alone, so there is no per-series fitting job to run or schedule.
- **Quantiles, not a single line** — every forecast comes with the 10th and 90th percentile (or any levels you ask for), which is what stock and capacity decisions need.
- **Your data stays in your container** — sales, sensor and usage history are forecast by your own service, not sent to a hosted forecasting API.
- **Fast on plain CPU** — a typical request takes well under a second on 8 vCPU, with no GPU bill and no per-call fee.
- **Private by default** — a generated bearer key guards every route but the health check, and the container refuses to start without one.

## Common Use Cases

- **Demand and capacity planning** — forecast sales, orders, traffic or queue depth from the history in your database.
- **Metric forecasting for agents** — give an LLM agent a forecasting tool it can call with one authenticated request, instead of asking it to extrapolate numbers.
- **Anomaly baselines** — compare live values to the 10th to 90th percentile band the model predicted for them.

## Dependencies for Chronos Hosting

- A service with **6 GB of RAM or more** (peak resident memory measured at 4.5 GB after requests up to the service's limits). Free and Trial plans cannot run it.
- No volume: the service keeps no state and the models are in the image.

### Deployment Dependencies

- [amazon-science/chronos-forecasting](https://github.com/amazon-science/chronos-forecasting) — the inference library, Apache-2.0, version 2.3.2
- [amazon/chronos-2](https://huggingface.co/amazon/chronos-2), [amazon/chronos-bolt-small](https://huggingface.co/amazon/chronos-bolt-small) and [amazon/chronos-bolt-base](https://huggingface.co/amazon/chronos-bolt-base) — the models
- [bon5co/chronos-railway](https://github.com/bon5co/chronos-railway) — the Railway wrapper image this template deploys, Apache-2.0
- Weights licence: the Hugging Face model card of `amazon/chronos-2` declares `license: apache-2.0`, and the Hugging Face API lists `license:apache-2.0` for `amazon/chronos-2`, `amazon/chronos-bolt-small` and `amazon/chronos-bolt-base`. Apache-2.0 allows commercial use and requires keeping the licence and attribution notices. Attribution: Chronos-2 and Chronos-Bolt, copyright Amazon Science, licensed Apache-2.0.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/chronos-or-just-updated-time-series-fore
