---
title: "Quickstart"
description: "Make your first OpenAI-compatible API call to Token Factory."
section: getting-started
order: 1
layout: guide
updated: "2026-06-16"
---

Make one OpenAI-compatible `/v1` chat request against Token Factory's live endpoint.

**Already onboarded and signed in? You're one API key away from your first call.**

  - **Endpoint:** `https://api.tokenfactory.omniva.com/v1`
  - **Env var:** `OMNIVA_API_KEY`
  - **Example model:** `Omniva/glm-5.3`

  
#### Get an API key
First, make sure you have workspace access and you're signed in — see [Workspace access](/docs/getting-started/workspace-access) (new customers [request access](mailto:sales@omniva.com)).

Once signed in, open [API keys](/api-keys) and click **Generate**. The full value is shown **once** at creation time — copy it now and keep it out of source control.

For rotation and leak-response, see [Authentication](/docs/getting-started/authentication).

  
#### Set your environment
Export the key under its canonical name. Every snippet below reads from it.

**macOS / Linux**

```bash
export OMNIVA_API_KEY="sk-oais..."
```

**Windows PowerShell**

```bash
$env:OMNIVA_API_KEY="sk-oais..."
```

  
#### Install a client
Token Factory's wire shape matches OpenAI's at `https://api.tokenfactory.omniva.com/v1`. Use the official OpenAI SDK or any HTTP client.

**Python**

```python
pip install openai
```

**TypeScript**

```typescript
npm install openai
```

**cURL**

```bash
# No install needed
```

  
#### Make your first call
Send a chat completion against `https://api.tokenfactory.omniva.com/v1`.

**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="Omniva/glm-5.3",
messages=[
    {
        "role": "user",
        "content": "Give me one sentence on retrieval-augmented generation.",
    }
],
)
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: "Omniva/glm-5.3",
  messages: [
{
  role: "user",
  content: "Give me one sentence on retrieval-augmented generation.",
},
  ],
});
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": "Omniva/glm-5.3",
"messages": [
  {
    "role": "user",
    "content": "Give me one sentence on retrieval-augmented generation."
  }
]
  }'
```

## Verification

> **That's it — first call worked.**
>
> You should see a short answer explaining retrieval-augmented generation, for example:
>
> > Retrieval-augmented generation combines a retrieval step over an external knowledge source with a generative model so the output is grounded in cited evidence.
>
> Exact wording varies between runs. If you got something back, the rest of Token Factory is one call away.

## What just happened?

  
**Request** — Your OpenAI-compatible client sent a request to Token Factory's `/v1/chat/completions` endpoint. [Read more →](/docs/serverless/chat-completions)

  
**Auth** — `OMNIVA_API_KEY` authenticated the request without putting the secret in source code. [Read more →](/docs/getting-started/authentication)

  
**Model** — `model` selected the hosted chat model. Replace it with any available chat model from [Models overview](/docs/getting-started/models-overview).

## Stream tokens (optional)

Pass `stream: true` when you want tokens to arrive incrementally — typical for chat UIs that render a typing effect. Deeper concerns (reconnects, partial-tool calls, cancellation, plus TypeScript and cURL variants) live in the [Streaming guide](/docs/serverless/streaming).

  
**Python**

```python
stream = client.chat.completions.create(
    model="Omniva/glm-5.3",
    messages=[{"role": "user", "content": "Count to five slowly."}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="", flush=True)
```

## What next

  - [Browse models](/docs/getting-started/models-overview) — What's in the catalog and how it's sorted.
  - [Stream responses](/docs/serverless/streaming) — Server-sent events, chunks, and cancellation.
  - [API reference](/docs/api-reference/chat-completions) — Full parameter and response schemas.

## Troubleshooting

> **Common first-run fixes**
>
> - `401 Unauthorized`: confirm `OMNIVA_API_KEY` is set in the same shell where you run the command.
> - `403 Forbidden`: your key is valid but doesn't have access to the requested resource. Check workspace membership.
> - `400` or `404` for the model: choose a model from [Models overview](/docs/getting-started/models-overview) and paste its exact ID.
> - `429 Too Many Requests`: check your quota and retry after the rate-limit window.
> - No output from streaming cURL: include `-N` so cURL does not buffer the stream.

Hitting an SSL trust-chain error? See [Errors → SSL](/docs/reference/errors#ssl). Model returning 503 instead of generating? See the [fallback pattern](/docs/reference/errors#503-service-unavailable).