Infrastructure
Regions
The Swarms API runs in 4 AWS regions, and each one has its own URL. Use the global URL to reach the nearest region, or call a regional URL to keep your inference in the United States or in Europe.
Global
Sends each request to the nearest region that is up. This is the default for every SDK and example.
https://api.swarms.worldAll regions
| Region | Location | API URL | Health |
|---|---|---|---|
US EastPrimary us-east-1 | N. Virginia, United States | https://us-east-1.api.swarms.world | Checking… |
US West us-west-1 | N. California, United States | https://us-west-1.api.swarms.world | Checking… |
Europe eu-central-1 | Frankfurt, Germany | https://eu-central-1.api.swarms.world | Checking… |
Asia Pacific ap-southeast-1 | Singapore, Singapore | https://ap-southeast-1.api.swarms.world | Checking… |
Health is each region's /health as this site sees it. Asleep means the region answered 503. US East is the primary region and is always on.
Keep inference in one place
The global URL picks whichever region is nearest and up, so a request from Europe can be served in the United States when Frankfurt is asleep. A regional URL always goes to its own region. If your requests have to stay in one place, set your base URL to a regional URL from the list below.
United States only
Requests are served in N. Virginia or N. California. US East is always on.
https://us-east-1.api.swarms.worldhttps://us-west-1.api.swarms.worldEurope only
Requests are served in Frankfurt, Germany.
https://eu-central-1.api.swarms.worldAsia Pacific only
Requests are served in Singapore.
https://ap-southeast-1.api.swarms.worldCode examples
Pick a region to see an agent completion sent to it. Only the base URL changes. Your API key, endpoints and request body are the same in every region.
Agent completion via eu-central-1.api.swarms.world
import osfrom typing import Any, TypedDictimport requestsclass AgentConfig(TypedDict): agent_name: str system_prompt: str model_name: str max_loops: int max_tokens: intclass AgentCompletionRequest(TypedDict): agent_config: AgentConfig task: strpayload: AgentCompletionRequest = { "agent_config": { "agent_name": "Research Analyst", "system_prompt": "You are a research analyst. Answer clearly and cite your reasoning.", "model_name": "gpt-5.4", "max_loops": 1, "max_tokens": 2048, }, "task": "Summarize the main obligations the EU AI Act places on model providers.",}response: requests.Response = requests.post( "https://eu-central-1.api.swarms.world/v1/agent/completions", headers={ "x-api-key": os.environ["SWARMS_API_KEY"], "Content-Type": "application/json", }, json=payload,)response.raise_for_status()data: dict[str, Any] = response.json()print(data)Choose the region from configuration
Read the region from an environment variable, so the same code runs in the United States for one deployment and in Europe for another.
import osimport requests# Where inference runs: "us" or "eu". Unset uses the nearest region that's up.REGION_URLS = { "us": "https://us-east-1.api.swarms.world", "eu": "https://eu-central-1.api.swarms.world",}BASE_URL = REGION_URLS.get(os.getenv("SWARMS_REGION", ""), "https://api.swarms.world")response = requests.post( f"{BASE_URL}/v1/agent/completions", headers={"x-api-key": os.environ["SWARMS_API_KEY"]}, json={ "agent_config": { "agent_name": "Research Analyst", "model_name": "gpt-5.4", "max_loops": 1, }, "task": "Summarize the main obligations the EU AI Act places on model providers.", }, timeout=120,)response.raise_for_status()print(response.json())Check a region before you send traffic
Every region serves /health. A 200 means it is up.
curl -s -o /dev/null -w "us-east-1: %{http_code}\n" https://us-east-1.api.swarms.world/healthcurl -s -o /dev/null -w "us-west-1: %{http_code}\n" https://us-west-1.api.swarms.world/healthcurl -s -o /dev/null -w "eu-central-1: %{http_code}\n" https://eu-central-1.api.swarms.world/healthcurl -s -o /dev/null -w "ap-southeast-1: %{http_code}\n" https://ap-southeast-1.api.swarms.world/health