1. Preflight the endpoint
Confirm that https://www.tken.shop/v1 is reachable, /models returns available model IDs, and a simple chat completion passes with the selected model. Keep prompts and keys out of screenshots and logs.
Framework integrations
Use TKEN as an OpenAI-compatible model gateway for server-side framework code. Validate the gateway endpoint first, then wire Vercel AI SDK, LangChain JavaScript, or LangChain Python with separate checks for streaming, tools, structured output, and agent loops.
TKEN_BASE_URL=https://www.tken.shop/v1
TKEN_MODEL=replace-with-a-model-from-/v1/models
1. List models
2. Run one non-streaming chat
3. Wire framework code
4. Test streaming/tools/agents separately
A framework error can come from the gateway, model ID, key, request shape, streaming mode, tool-calling assumptions, or app code. Prove the gateway path first so the framework test has a clean baseline.
Confirm that https://www.tken.shop/v1 is reachable, /models returns available model IDs, and a simple chat completion passes with the selected model. Keep prompts and keys out of screenshots and logs.
Use the OpenAI-compatible provider with a server-only API key and baseURL set to the TKEN /v1 endpoint. Start with non-streaming text generation before enabling streaming routes.
Configure ChatOpenAI with the TKEN API key, model ID, and custom OpenAI-compatible base URL. Test one direct invoke call before adding chains, retrievers, memory, tools, or agents.
Treat streaming, tool calls, structured output, embeddings, and agent loops as separate capabilities. Route production traffic only after the selected model path has passed the feature you need.
Keep examples short and server-side during rollout. These shapes show where the OpenAI-compatible base URL belongs; production apps still need timeouts, redaction, fallback, budget controls, and feature checks.
import { generateText } from "ai";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
const tken = createOpenAICompatible({
name: "tken",
apiKey: process.env.TKEN_API_KEY,
baseURL: process.env.TKEN_BASE_URL || "https://www.tken.shop/v1"
});
const { text } = await generateText({
model: tken(process.env.TKEN_MODEL),
prompt: "Reply with one short sentence."
});
Use a server route or backend action for key handling. If a model route does not pass streaming, keep that first rollout on non-streaming generation and test streaming again with a route that passed capability smoke tests.
Start with a direct ChatOpenAI invoke call and a custom baseURL in configuration. Add tools, agents, callbacks, and tracing only after the direct chat path returns the expected shape.
Pass base_url to langchain_openai.ChatOpenAI and keep one direct invoke test separate from retrievers, output parsers, chains, and agents. Do not rely on non-standard fields unless tested.
Redact keys, account IDs, private prompts, usage records, and provider dashboard details. Set request timeouts, retry limits, token limits, and rollback criteria before routing user traffic.
Use the public example repo as the implementation reference, then verify the selected model route against your own TKEN key before production traffic.
Open the server-side setup guide for `createOpenAICompatible`, baseURL, and rollout checks.
Open the LangChain JS and Python guide for direct `ChatOpenAI` tests before chains or agents.
Open the v0.19.0 framework examples release to review the runnable examples and change summary.
Check that the server environment contains the right TKEN key and that the key is not being read from public browser code.
Confirm that the base URL includes /v1 and that framework code is not appending an incompatible path.
Pick a model ID returned by /v1/models instead of copying a model name from another provider dashboard or example.
Test streaming, tool calls, JSON output, embeddings, and agent behavior as separate capability checks before enabling them for production users.
Create an API key, list models, run one direct chat request, then wire framework code with explicit capability gates.