---
title: "Migrate from an OpenAI-compatible API"
description: "Swap base URL and key — keep your code."
section: getting-started
order: 5
layout: guide
updated: "2026-06-12"
---

If you're already calling an OpenAI-compatible API, you're most of the way to Token Factory. The wire shape matches — same client libraries, same request bodies, same response envelopes. Two lines change.

This page covers the swap, the model-ID shift, the parameters that don't yet round-trip, and where to find the rest.

## The two-line change

Point your existing OpenAI-compatible client at `https://api.tokenfactory.omniva.com/v1` and pass a Token Factory API key.

  
**Python**

```python
from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["OMNIVA_API_KEY"],
    base_url="https://api.tokenfactory.omniva.com/v1",
)

resp = client.chat.completions.create(
    model="<chat-model-id>",
    messages=[{"role": "user", "content": "Hello."}],
)
print(resp.choices[0].message.content)
```

  
**TypeScript**

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OMNIVA_API_KEY,
  baseURL: "https://api.tokenfactory.omniva.com/v1",
});

const resp = await client.chat.completions.create({
  model: "<chat-model-id>",
  messages: [{ role: "user", content: "Hello." }],
});
console.log(resp.choices[0].message.content);
```

  
**cURL**

```bash
curl https://api.tokenfactory.omniva.com/v1/chat/completions \
  -H "Authorization: Bearer $OMNIVA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<chat-model-id>",
    "messages": [{"role": "user", "content": "Hello."}]
  }'
```

Mint a Token Factory key from [API keys](/api-keys) and export it as `OMNIVA_API_KEY`. Full minting and rotation guidance lives in [Authentication](/docs/getting-started/authentication).

## Model IDs

OpenAI uses opaque short names — `gpt-4`, `text-embedding-3-small`. Token Factory ids are explicit and prefixed, in the form `provider/model-name`, and the prefix carries meaning. An `Omniva/…` id (for example `Omniva/glm-5.2`) is an **Omniva-optimized build** of an open model — tuned and quantized for low-latency serving. The same base model may also be offered as raw upstream open weights under its **author** prefix (for example `zai-org/GLM-5.2`). Pass the exact catalog id as `model`.

Pick a model ID from your workspace catalog in [Models overview](/docs/getting-started/models-overview), or list them programmatically with [`GET /v1/models`](/docs/api-reference/models). The ID you choose goes straight into the `model` field.

## Parameters dropped today

The chat-completions handler currently reads `model`, `messages`, `temperature`, `max_tokens`, and `stream`. The following OpenAI request fields are accepted in the body but **ignored** — they will not change the response:

- `top_p`, `n`, `seed`
- `presence_penalty`, `frequency_penalty`
- `stop`
- `tools`, `tool_choice`, `response_format`
- `user`, `logprobs`, `service_tier`

If your existing code sets any of these, the call will succeed but those knobs won't take effect. Full list with status is on the [Chat completions reference](/docs/api-reference/chat-completions#not-yet-supported).

## Errors

OpenAI returns a nested envelope (`{ "error": { "message", "type", "param", "code" } }`). Token Factory returns the same nested shape on the public API surface, but inspect the `status` and `code` fields with care — the catalog of codes is Token Factory's, not OpenAI's. The full error catalog and retry guidance is in [Errors](/docs/reference/errors).

If you're on a corporate network and your first call hits `CERTIFICATE_VERIFY_FAILED`, see [Errors → SSL](/docs/reference/errors#ssl) for the proxy / CA-bundle remediation.

## What about embeddings and tools?

  - [Embeddings](/docs/serverless/embeddings) — `POST /v1/embeddings` works the same way — swap base URL and pick an embedding model.
  - [Tools](/docs/serverless/chat-completions#function-calling) — Tool-calling round-trip is on the roadmap — see status in the chat-completions guide.

## What next

  - [Authentication](/docs/getting-started/authentication) — Mint, rotate, and revoke API keys.
  - [Models overview](/docs/getting-started/models-overview) — Browse the catalog and pick an ID.
  - [Streaming](/docs/serverless/streaming) — Token-by-token output via Server-Sent Events.

