Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 2.23 KB

File metadata and controls

63 lines (43 loc) · 2.23 KB

Route Key OpenAI-Compatible API Quickstart

This guide shows the smallest safe request through the Route Key OpenAI-compatible API gateway.

Requirements

  • A Route Key account and API key
  • An enabled model ID from the Models catalog
  • A client that supports OpenAI-compatible chat completions

The public base URL is:

https://api.routekey.ai/v1

curl

export ROUTEKEY_API_KEY="your_routekey_api_key"
export ROUTEKEY_MODEL="MODEL_ID_FROM_CATALOG"

curl https://api.routekey.ai/v1/chat/completions \
  -H "Authorization: Bearer ${ROUTEKEY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "{\"model\":\"${ROUTEKEY_MODEL}\",\"messages\":[{\"role\":\"user\",\"content\":\"Reply with one short sentence.\"}]}"

SDK configuration

Python and Node.js examples are available in examples/. The important configuration values are:

API key:  ROUTEKEY_API_KEY
Base URL: https://api.routekey.ai/v1
Model:    an enabled model ID from the catalog

Keep the key in an environment variable or a protected secret store. Do not add it to source control.

Verify the response

Check that:

  1. The HTTP response is successful.
  2. The response contains the expected assistant message.
  3. The returned model and Usage Logs match the intended model ID.
  4. Input tokens, output tokens, latency, cost, and retries are visible as expected.

Start with a short, reversible request. Test streaming, tool calls, structured output, and multimodal inputs separately if your application depends on them.

Troubleshooting

Symptom Checks
401 or 403 Confirm the key, Bearer prefix, account access, and environment variable.
Model not found Copy the exact enabled model ID from the live catalog.
404 on the endpoint Check the base URL and make sure the client has not appended /v1 twice.
Streaming mismatch Confirm the client parser and test a non-streaming response first.
Unexpected cost Review model, group, endpoint, retries, and token counts in Usage Logs.

For client-specific setup, use the integration guide. For request details, use the developer docs.