Quickstart: gateway

Send requests through Open Token's OpenAI-compatible API. Inference runs in your own AWS account.

Updated September 26, 2026

The gateway is an OpenAI-compatible API for the models on Amazon Bedrock. Any OpenAI SDK, LangChain, LlamaIndex or the Vercel AI SDK works by changing the base URL. Requests run on your AWS account with your own credentials (bring your own key), and every request shows up in Activity with tokens and estimated AWS cost.

1. Connect your AWS account

Under Integrations, connect your AWS account. With a role connection, you create an IAM role in your account with one click (CloudFormation); Open Token assumes it with an external ID unique to your organization, and you can revoke it at any time. Where role connections aren't enabled yet, add an access key allowed to call bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream instead; it's encrypted at rest and never shown again. Without a connection, requests fail with 403 byok_required.

2. Create an API key

Keys start with ot-, are shown once and are stored only as a hash. Create one here or under API keys:

Create a key in the Open Token dashboard. It's shown once.Start freeSign in

3. Set your environment

.env
export OT_BASE_URL="https://getopentoken.com/v1"
# Tools that read the standard OpenAI variables work unchanged:
export OPENAI_BASE_URL="$OT_BASE_URL"
export OPENAI_API_KEY="$OT_API_KEY"

Or download a ready-made env file for your organization (it has no secrets in it):

Sign in to download it with your organization's values filled in.

4. Send a request

shell
curl https://getopentoken.com/v1/chat/completions \
  -H "Authorization: Bearer $OT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "amazon/nova-lite",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'

The response is a standard chat completion. usage includes tokens and the cost in USD; see the API reference.

Keep your app up if we're down

Put a timeout and a fallback around gateway calls so a problem on our side never stops your traffic: call Amazon Bedrock directly when the gateway doesn't answer in time or returns a 5xx. In LangChain, with_fallbacks does this; with any HTTP client, a short connect timeout plus a direct Bedrock call does the same. Don't retry a request that already started streaming: you'd pay for the tokens twice.

The opentoken SDK does this for you: automatic fail-open, a circuit breaker and remote per-feature routing. See SDK and fail-open, and the SDK and OpenAI SDK guide to trace your calls too.