Token Factory · Documentation
Omniva Token Factory Documentation
Token Factory is easy to use with an OpenAI-compatible /v1 API that works with your existing workflows. During Early Access please contact sales for help getting started.
Endpoint
https://api.tokenfactory.omniva.com/v1Env var
OMNIVA_API_KEYExample model
Omniva/Kimi-K2.6First call
Request
from openai import OpenAI
client = OpenAI(
api_key="sk-...",
base_url="https://api.tokenfactory.omniva.com/v1",
)
resp = client.chat.completions.create(
model="Omniva/Kimi-K2.6",
messages=[{"role": "user", "content": "Say hi."}],
)
print(resp.choices[0].message.content)200application/json
{
"id": "chatcmpl-7b1f6c…",
"object": "chat.completion",
"model": "Omniva/Kimi-K2.6",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi! How can I help?"
},
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 9, "completion_tokens": 7, "total_tokens": 16 }
}The same OpenAI SDK works — point
base_url at https://api.tokenfactory.omniva.com/v1.Open the full QuickstartBuild something
Quickstart
Your first chat call
from openai import OpenAI
client = OpenAI(base_url=BASE_URL, api_key=KEY)
resp = client.chat.completions.create(
model="Omniva/Kimi-K2.6",
messages=[{"role": "user", "content": "Hi"}],
)PY/v1/chat/completions
Open recipeStreaming
Stream tokens to the browser
const stream = await client.chat.completions.create({
model: "Omniva/Kimi-K2.6",
messages,
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0].delta.content ?? "");
}TS/v1/chat/completions
Open recipeEmbeddings
Embed and search documents
res = client.embeddings.create(
model="<embedding-model-id>",
input=["the cat sat on the mat"],
)
vec = res.data[0].embedding
print(len(vec), vec[:3])PY/v1/embeddings
Open recipeMigration
Move from OpenAI in one line
# Before: client = OpenAI(api_key=OPENAI_KEY)
# After:
client = OpenAI(
base_url="https://api.tokenfactory.omniva.com/v1",
api_key=AISTUDIO_KEY,
)
# Everything else stays the same.PY
Open recipeAuth
Create and rotate API keys
# Create the key in the dashboard:
# Developer → API Keys → Create
export OMNIVA_API_KEY="sk-oais..."
echo "key set (${OMNIVA_API_KEY:0:7}...)"SH
Open recipeErrors
Handle failures cleanly
try:
client.chat.completions.create(model=MODEL, messages=msgs)
except openai.RateLimitError as e:
retry_after = e.response.headers.get("Retry-After", 30)
time.sleep(int(retry_after))PY
Open recipe