> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gengen.farm/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI-compatible LLMs

> Use GENGEN chat models with the OpenAI Python or JavaScript SDK.

GENGEN provides an OpenAI-compatible Chat Completions endpoint for supported
LLM models. Existing server-side applications can use the OpenAI Python or
JavaScript SDK by changing the API key, base URL, and model ID.

## Compatibility base URL

```text theme={"dark"}
https://gengen.farm/v1
```

The SDK appends `/chat/completions`, producing this request URL:

```text theme={"dark"}
https://gengen.farm/v1/chat/completions
```

Use a GENGEN workspace API key beginning with `gengen_live_`.

<Warning>
  The `/v1` compatibility base URL currently supports Chat Completions only.
  Do not assume that OpenAI SDK resources such as Responses, Models, Images,
  Files, or Assistants are available through this base URL. Use the documented
  canonical GENGEN endpoints for other capabilities.
</Warning>

## Python

Install the OpenAI Python SDK:

```bash theme={"dark"}
pip install openai
```

Configure the client with your GENGEN API key and compatibility base URL:

```python theme={"dark"}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GENGEN_API_KEY"],
    base_url="https://gengen.farm/v1",
)

completion = client.chat.completions.create(
    model="seed-2-0-lite-260428",
    messages=[
        {
            "role": "user",
            "content": "Explain idempotency in two sentences.",
        }
    ],
)

print(completion.choices[0].message.content)
```

## JavaScript

Install the OpenAI JavaScript SDK:

```bash theme={"dark"}
npm install openai
```

Configure `baseURL` when creating the client:

```javascript theme={"dark"}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.GENGEN_API_KEY,
  baseURL: "https://gengen.farm/v1",
});

const completion = await client.chat.completions.create({
  model: "seed-2-0-lite-260428",
  messages: [
    {
      role: "user",
      content: "Explain idempotency in two sentences.",
    },
  ],
});

console.log(completion.choices[0].message.content);
```

## Direct HTTP endpoint

Applications that do not use an OpenAI SDK can call the canonical GENGEN
endpoint directly:

```text theme={"dark"}
POST https://gengen.farm/api/gengen/v1/chat/completions
```

Both URLs use the same GENGEN API key, model IDs, billing, request body, and
response format. Streaming Chat Completions are also supported through the
compatibility URL.

See [Create a chat completion](/api-reference/byteplus/text-generation/chat-completions)
for supported parameters, models, streaming behavior, and response schemas.

## Function calling

All listed Seed, DeepSeek, GLM, and Gemini LLMs accept function tools through Chat
Completions, including SSE streaming. Preserve the full assistant message when
returning tool results, including provider reasoning and Gemini thought signatures.
See [Function calling and Gemini tools](/tool-calling) for working examples and
Gemini Code execution and Computer use.
