Quickstart

HTTP Quickstart: Read Air-Quality Data

Run a ready-made virtual air-quality station and request its simulated measurements over HTTP.

Before you begin

Install SPX with HTTP support and SPX UI. Have an HTTP client ready. This quickstart uses the ready-made air-quality station model. Its measurements are simulated sample data.

Run the test

1. Start the station

  • In Instances → New instance, choose Env.AirQualityStation.Http. If it is missing, import the linked YAML using Models → Load model from file.
  • Create and start an instance. The default HTTP adapter port is 8092. In Communication → http_endpoint, check the configured host and port.
SPX UI showing the HTTP endpoint of a running library air-quality station on port 8092.
The station's HTTP endpoint in SPX UI.

Screenshot preview

The station's HTTP endpoint in SPX UI. Open original image

2. Request simulated measurements

  • Send GET http://SPX_HOST:8092/v1/air-quality/urban-baseline, replacing the address and port with those reachable from your client.
  • Expect 200 OK and a JSON response. At the model defaults, current.pm2_5 is 26.4 and current.pm10 is 39.5 µg/m³. The full response also contains station metadata and sample hourly readings.
{
  "current": { "timestamp": "2025-01-01T12:00", "pm2_5": 26.4, "pm10": 39.5 }
}

This is an excerpt of the response, not the full JSON. The timestamp and measurements are simulated.

3. Compare with SPX UI

  • Open Attributes and compare k__current_pm2_5 and k__current_pm10 with the JSON values.
  • Explore the model's Scenarios to see how changing simulated measurements affect the response. The endpoint's profile path parameter changes the active profile; use the intended profile when testing.

Check the result

0.0.0.0 is a listen address, not the address to enter in your client. If SPX runs in Docker, the adapter's TCP port must be published or otherwise reachable from your client. In our test port 18092 was reachable inside the server container but not on the host; your setup may use a different mapping.

Protocol communication

SettingExample
RequestGET /v1/air-quality/urban-baseline
Default adapter portTCP 8092
ResponseHTTP 200, JSON with station, hourly_readings and current
BaselinePM2.5 26.4 and PM10 39.5 µg/m³

Ask your AI agent

Open your SPX workspace in a local agent:

Prompt for your AI agent

Run the ready-made SPX air-quality-station HTTP model for the quickstart. Create exactly one temporary instance, start it, and verify the real HTTP JSON GET endpoint using JSON values. Report the model ID, endpoint path, and actual response. Clean up only the instance you created; preserve all other workspace resources.

Tested with GPT-6 Luna · Medium

Estimated API cost · $0.0057 per run

In our GPT-6 Luna · Medium session the model started on port 18092. The agent sent the GET from inside the SPX container and verified 200 OK and the baseline values above. The port was not published on the host.

Next steps

Create a custom air-quality model with an AI agent. For adapter configuration, see the HTTP adapter guide.