Skip to content

Deploy stdapi.ai on AWS

Get a production-grade AI gateway running on AWS with two Terraform commands, speaking the OpenAI, Anthropic, and Cohere APIs. Terraform provisions the stack — ECS Fargate, HTTPS, auto-scaling, optional WAF, and optional monitoring. You bring the Marketplace subscription, AWS credentials, and — for a custom domain — the domain and its certificate.

14-Day Free Trial

The AWS Marketplace subscription includes a 14-day free trial of the stdapi.ai license. AWS charges for the infrastructure it deploys (ALB, Fargate, KMS, NAT) and for Bedrock usage apply from the first minute — see Deployment Cost.

Need help?

For questions, issue reports, or assistance, see the Contact page.


Quick Start

Prerequisites

  1. Subscribe on AWS Marketplace — this is the action that starts your 14-day free trial:

    Subscribe on AWS Marketplace — starts your 14-day free trial

  2. Install Terraform or OpenTofu >= 1.5.

  3. Configure AWS credentials (aws configure or aws sso login).

AWS infrastructure cost depends entirely on your configuration — from a single scheduled Spot container with no load balancer to a full multi-AZ stack — so there's no one figure to quote; see Deployment Cost below. stdapi.ai's own license runs $0.10/container-hour ($0.09 via private offer); Bedrock usage is billed separately by AWS at cost.

Requires AWS administrator permissions

The Terraform module provisions IAM roles and policies, KMS keys, ECS/Fargate, ALB, and networking. A restricted developer profile will fail during terraform apply.

Strongly recommended: deploy into a sandbox / non-production AWS account first to evaluate the stack, then replicate into your target account with scoped-down principals once you've validated it.

Confirm your AWS identity and region before deploying

The AWS provider uses the region and profile from your environment — not a Terraform variable. Check both before running terraform apply:

aws sts get-caller-identity
aws configure get region

Deploy

git clone https://github.com/stdapi-ai/samples.git
cd samples/getting_started_production/terraform
terraform init
terraform apply
No git? Download the ZIP
curl -L https://github.com/stdapi-ai/samples/archive/refs/heads/main.zip -o samples.zip
unzip samples.zip
cd samples-main/getting_started_production/terraform
terraform init
terraform apply

That's it. Two Terraform commands, and you have:

  • Production-grade ECS Fargate deployment with HTTPS
  • Regional S3 buckets
  • Auto-scaling and API key authentication
  • Interactive API documentation at /docs
  • IP-restricted access (your IP only)
%%{init: {'flowchart': {'htmlLabels': true}} }%%
flowchart LR
  openai["<img src='../styles/logo_openai.svg' style='height:64px;width:auto;vertical-align:middle;' /> OpenAI SDK"] -->|HTTPS| alb["<img src='../styles/logo_amazon_load_balancing.svg' style='height:64px;width:auto;vertical-align:middle;' /> ALB"]
  anthropic["<img src='../styles/logo_anthropic.svg' style='height:64px;width:auto;vertical-align:middle;' /> Anthropic SDK"] -->|HTTPS| alb
  alb --> ecs["<img src='../styles/logo.svg' style='height:64px;width:auto;vertical-align:middle;' /> stdapi.ai<br/>ECS Fargate"]
  ecs --> bedrock["<img src='../styles/logo_amazon_bedrock.svg' style='height:64px;width:auto;vertical-align:middle;' /> Amazon Bedrock"]
  ecs --> polly["<img src='../styles/logo_amazon_polly.svg' style='height:64px;width:auto;vertical-align:middle;' /> Amazon Polly"]
  ecs --> transcribe["<img src='../styles/logo_amazon_transcribe.svg' style='height:64px;width:auto;vertical-align:middle;' /> Amazon Transcribe"]
  ecs --> s3["<img src='../styles/logo_amazon_s3.svg' style='height:64px;width:auto;vertical-align:middle;' /> Amazon S3"]
  ecs --> cloudwatch["<img src='../styles/logo_amazon_cloudwatch.svg' style='height:64px;width:auto;vertical-align:middle;' /> CloudWatch"]

Get Your Credentials

terraform output -raw api_key
terraform output api_endpoint
terraform output docs_url

Ready-to-use Terraform example on GitHub

Single regiongetting_started_production

Optional: expose the API as MCP tools

The MCP server is off by default. Set enable_mcp_streamable_http = true on the Terraform module and every endpoint becomes a named MCP tool at <api_endpoint>/mcp, callable directly by Claude Code, LangGraph, or any MCP client.

Every exposed tool adds its schema to each MCP client's context window, so expose only the tools your agents actually use — for example mcp_include_tools = "openai_chat_completion,openai_embedding,search_models". See the MCP configuration reference.

Buying for an organization? Use an AWS Marketplace private offer

Custom terms and duration, committed usage, and a preferential rate of $0.09/container-hour instead of $0.10. Procured through your existing AWS relationship — no new vendor onboarding, billed on your existing AWS invoice. Want to try first? Use the 14-day free trial of the public listing, then accept the private offer.

Request a Private Offer


Make Your First API Call

Want to explore the API without writing code? Use the docs_url from terraform output docs_url to open the interactive Swagger documentation in your browser — you can browse all available endpoints and make live API calls directly from the page, no code required.

If the docs page returns 503 or shows a TLS warning

These are normal on a fresh deployment. The ECS service takes 2–3 minutes to pass health checks (→ 503), and the auto-generated *.elb.amazonaws.com domain has no trusted TLS certificate (→ browser warning; safe to bypass for testing). See Troubleshooting for a permanent HTTPS setup with a custom domain.

stdapi.ai is compatible with both OpenAI and Anthropic SDKs. If you've used either before, you already know how to use it — the base URL changes, along with the API key, and the model name only where it differs, since Anthropic's and OpenAI's own names for the models Bedrock serves resolve here as they stand. Here are the raw HTTP calls with curl so you can verify the endpoint from any shell:

API_ENDPOINT=$(terraform output -raw api_endpoint)
API_KEY=$(terraform output -raw api_key)

curl "$API_ENDPOINT/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "amazon.nova-micro-v1:0",
    "messages": [{"role": "user", "content": "Hello! Tell me a joke."}]
  }'
API_ENDPOINT=$(terraform output -raw api_endpoint)
API_KEY=$(terraform output -raw api_key)

curl "$API_ENDPOINT/anthropic/v1/messages" \
  -H "x-api-key: $API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "amazon.nova-micro-v1:0",
    "max_tokens": 1000,
    "messages": [{"role": "user", "content": "Hello! Tell me a joke."}]
  }'

Using the official SDKs? Point the base_url (Python) / baseURL (Node.js) option at $API_ENDPOINT/v1 (OpenAI SDK) or $API_ENDPOINT/anthropic (Anthropic SDK), and set the model field to a model from the catalog below. The rest of your existing code is unchanged. The API Overview has SDK snippets for Python, Node.js, and more.

Discover the full model catalog

Once your first call succeeds, switch the model field to any other Bedrock model — anthropic.claude-fable-5, anthropic.claude-sonnet-5, qwen.qwen3-coder-next, and more.

  • Browse before you switch: the Models page lists everything with prices and scores
  • Browse active models (recommended): GET /search_models — returns every discovered non-legacy model with full details (provider, modalities, supported routes, regions, streaming/legacy status). Add legacy=true to look up a deprecated model instead. Or open the interactive Swagger docs.
  • Find a model by capability: the same endpoint filters by modality, route, region, streaming, Batch API support, or legacy status — e.g. GET /search_models?input_modalities=IMAGE&route=/v1/chat/completions returns only vision-capable chat models. This is also the recommended way for AI agents to discover the right model ID before calling another endpoint. See the Search Models API reference.
  • OpenAI SDK compatibility: GET /v1/models is also available with the standard OpenAI listing format (lighter payload, no capability metadata) for tools that require the exact OpenAI schema.

Using your own Terraform config instead of the sample? The sample above enables authentication for you (api_key_create = true, retrieved above). Writing your own module config from scratch? stdapi.ai runs without authentication unless you set api_key_create = true — see Authentication & Security for all options.

Verify the deployment is healthy:

curl $API_ENDPOINT/health
# → {"status": "ok"}

The /health endpoint requires no authentication and is used by the ALB health check.


Troubleshooting

The 503 and TLS-warning hiccups on first deployment are already covered above — see Make Your First API Call.

Full troubleshooting guide: Troubleshooting — 401 auth errors, 404 model not found, ThrottlingException, S3 errors, VPC connectivity, Terraform IAM failures, and more.

Prefer a hands-off setup?

A managed deployment service is available if you'd rather not manage Terraform yourself. Choose between guided assistance (step-by-step support while you retain full control) or fully managed setup (handled on your behalf, inside your AWS account). Response time is 1 business day during the engagement.


Deployment Cost

AWS infrastructure cost is driven by configuration, not a fixed default: task count (one per Availability Zone unless overridden), Fargate Spot vs. on-demand, scheduled service hours, and whether an ALB is provisioned at all. A minimal deployment — one scheduled Fargate Spot task, no ALB, reached via Service Discovery — and a full multi-AZ production stack — ALB + WAF, one task per AZ, running 24/7 — sit at opposite ends of a wide range.

stdapi.ai's own license is billed separately at $0.10/container-hour ($0.09 via private offer); Bedrock and other AI service usage is billed by AWS at cost, with no stdapi.ai markup.

See Cost-Optimized Deployment for the Spot/scheduling configuration, and Cost Management → Gateway Cost for the full tier-by-tier breakdown.


Cleaning Up

When you're done testing, tear down the stack to stop incurring AWS and license charges:

terraform destroy

Running from the ZIP download instead of git clone? Run the same command from the samples-main/getting_started_production/terraform directory.


Next Steps