First request

One endpoint. Your first routed response.

Use the OpenAI SDK you already know or call the HTTP API directly. OpenWaya authenticates, applies policy, selects a healthy route, meters usage, and returns one compatible response.

01 / Create a key

Keep credentials outside your code.

Create a workspace-scoped key in the dashboard with only the permissions and limits this application needs. The full value is shown once; store it in your server-side secret manager and never expose it in browser JavaScript.

Create API key
# .env.local — never commit this file
OPENWAYA_API_KEY=ow_live_••••••••••••

# shell
export OPENWAYA_API_KEY="ow_live_••••••••••••"

02 / Send a request

JavaScript, Python, or direct HTTP.

JavaScriptnpm install openai
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENWAYA_API_KEY,
  baseURL: "https://api.openwaya.africa/v1",
  maxRetries: 0,
  timeout: 30_000,
});

const response = await client.chat.completions.create(
  {
    model: "openwaya/auto",
    messages: [{ role: "user", content: "Hello from Africa" }],
  },
  { headers: { "Idempotency-Key": crypto.randomUUID() } },
);

console.log(response.choices[0].message.content);
Pythonpip install openai
import os
import uuid
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENWAYA_API_KEY"],
    base_url="https://api.openwaya.africa/v1",
    max_retries=0,
    timeout=30.0,
)

response = client.chat.completions.create(
    model="openwaya/auto",
    messages=[{"role": "user", "content": "Hello from Africa"}],
    extra_headers={"Idempotency-Key": str(uuid.uuid4())},
)

print(response.choices[0].message.content)
cURLNo SDK required
idempotency_key="request-$(openssl rand -hex 16)"

curl https://api.openwaya.africa/v1/chat/completions \
  --fail-with-body \
  -H "Authorization: Bearer $OPENWAYA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $idempotency_key" \
  -d '{
    "model": "openwaya/auto",
    "messages": [
      {"role": "user", "content": "Hello from Africa"}
    ]
  }'

03 / Migrate from OpenAI

Change the boundary, not the SDK.

Supported message shapes, streaming loops, and response parsing stay in place. Add the OpenWaya base URL and choose an explicit catalog model or openwaya/auto. Review unsupported fields before moving production traffic.

Existing OpenAI clientapiKey: process.env.OPENAI_API_KEYOpenWaya clientapiKey: process.env.OPENWAYA_API_KEYbaseURL: "https://api.openwaya.africa/v1"

04 / Inspect the route

Know what happened after send.

  1. Request ID

    Correlates authentication, routing, provider attempts, usage, and logs.

  2. Resolved model

    Shows the model and provider route selected by policy.

  3. Usage

    Separates input, cached input, reasoning, and output tokens.

  4. Configuration snapshot

    Preserves the exact routing and pricing rules used for the request.

Next steps

Move from first response to production traffic.