Embeddings API

Build embeddings through the TKEN gateway

Point OpenAI-compatible SDK clients at https://www.tken.shop/v1, run a small vector smoke test, then use the same server-side pattern for search, clustering and retrieval jobs.

Node.js embeddings smoke test
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.TKEN_API_KEY,
  baseURL: "https://www.tken.shop/v1"
});

const result = await client.embeddings.create({
  model: process.env.TKEN_EMBEDDING_MODEL,
  input: [
    "TKEN is an OpenAI-compatible API gateway.",
    "Vector search works best with consistent dimensions."
  ]
});

console.log(result.data.map(item => item.embedding.length));
Use one gateway base URL
Keep vector dimensions consistent
Store keys outside client-side code

Python backend job

Treat embedding generation as a backend workflow. Capture only non-sensitive request metadata in logs, and keep raw documents out of shared debugging output.

Python server-side key
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TKEN_API_KEY"],
    base_url="https://www.tken.shop/v1",
)

response = client.embeddings.create(
    model=os.environ["TKEN_EMBEDDING_MODEL"],
    input="Create a vector for retrieval testing.",
)

vector = response.data[0].embedding
print(len(vector))

Embedding rollout checklist

1. Confirm model availability

Choose an embedding model visible in your TKEN account and keep its vector dimension stable for each index.

2. Test batch size

Start with a short input batch, then increase throughput only after latency, error rate and billing behavior are understood.

3. Protect document data

Redact customer identifiers, raw private documents and API keys before storing logs or sharing examples.

Disclosure: TKEN is an independent third-party API gateway, not an official endpoint for OpenAI or other model providers.

Run an embeddings smoke test

Verify one request, confirm vector shape, then move the same https://www.tken.shop/v1 base URL into your retrieval workflow.