Endpoint preflight

Preflight an OpenAI-compatible API before tool rollout

Validate the base URL, key handling, model discovery, selected model ID, and one non-streaming chat request before pointing an SDK, agent host, proxy, or UI at TKEN. Start small, save redacted evidence, then move into streaming, agents, or team traffic.

Preflight sequence Use /v1
$env:TKEN_API_KEY="sk-your-tken-key"
$env:TKEN_BASE_URL="https://www.tken.shop/v1"

node tools/endpoint-tester.mjs `
  --base-url $env:TKEN_BASE_URL `
  --api-key-env TKEN_API_KEY `
  --skip-chat `
  --json

# Then choose a model returned by /models.
Base URL must include /v1
Verify /models before choosing a model
Run one non-streaming chat before agents

What to prove first

A useful preflight separates configuration errors from provider availability, quota, and app-level bugs. Keep the first request set small enough that a failure is easy to classify.

Base URL
https://www.tken.shop/v1
Key handling
Environment variable only
Model discovery
GET /models returns IDs
Model choice
Use an ID returned by /models
Chat shape
One small non-streaming request
Evidence
Status, count, latency, redacted preview

Preflight steps

1. Check /models only

Start with the lowest-risk reachability check. A successful response proves that the base URL, key loading, and account access are usable before any prompt content is sent.

2. Choose a returned model ID

Do not copy a model name from marketing copy, another account, or a provider page. Model IDs can vary by account, channel, provider status, and release timing.

3. Run one non-streaming chat

Use one small, non-sensitive prompt. Confirm the HTTP status, response shape, timeout, and short preview before testing streaming, JSON output, tool calls, embeddings, or agent loops.

4. Save redacted evidence

Store the base URL, env var name, status codes, model count, selected model, timeout, and failure class. Do not store keys, account identifiers, order details, usage records, private prompts, or provider account screens.

Failure classes

Classify the first failure before changing app code. Most rollout problems come from a small set of endpoint, account, quota, model, timeout, or response-shape issues.

401
Missing, expired, invalid, or unauthorized key
404
Wrong base URL or missing /v1
Empty models
Account access or route availability
Model not found
Selected ID was not returned by /models
429
Rate limit, balance, cap, or concurrency
Timeout or 5xx
Retry later with backoff and redacted status

Rollout gate

Endpoint proof

/models succeeds with the deployment key, the selected model ID was returned by /models, and one non-streaming chat completion succeeds with a non-sensitive prompt.

App guardrails

The app has request timeouts, retry caps, token caps, error logging, spend limits, owner alerts, and a documented rollback route before production traffic grows.

Evidence hygiene

Logs, screenshots, issue reports, and handoff docs redact keys, account IDs, private prompts, usage records, provider account screens, and full sensitive response bodies.

TKEN is an independent third-party OpenAI-compatible API gateway. It is not officially affiliated with OpenAI or other model providers. Model availability, pricing, context limits, streaming behavior, tool support, and rate limits can vary by account, channel, and provider status. Live /pricing remains the source of truth.

Endpoint preflight FAQ

What should I test before using an OpenAI-compatible base URL?

Confirm that the base URL ends in /v1, the key is loaded from an environment variable, /models returns IDs, the selected model came from /models, and one small non-streaming chat request succeeds.

Why should the selected model come from /models?

It prevents stale model names and account-specific availability mismatches. If /models does not return an ID, do not assume that ID is safe for the rollout.

What evidence is safe to save?

Save status codes, model count, a few sample IDs, selected model, latency, timeout, and a short redacted preview. Do not save keys, account IDs, usage records, private prompts, or provider screens.

Where is the full endpoint tester guide?

Use the GitHub playbook for command details, expected JSON shape, failure classes, and a safe evidence template. Read the endpoint preflight playbook.

Run the smallest safe endpoint check first

Create a TKEN key, set https://www.tken.shop/v1 as the base URL, verify /models, then run one non-streaming chat before connecting real tools, agents, or team traffic.