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

# OpenAI Compatibility

> Use existing OpenAI SDKs and tools with Lumenfall

Lumenfall implements the OpenAI API specification for chat completions, image generation, and video generation. This means you can use any OpenAI-compatible SDK, tool, or library with Lumenfall by simply changing the base URL.

## Supported endpoints

| Endpoint                                                     | Description                                |
| ------------------------------------------------------------ | ------------------------------------------ |
| [`POST /chat/completions`](/api-reference/chat/completions)  | Generate text from a conversation          |
| [`POST /images/generations`](/api-reference/images/generate) | Generate images from text prompts          |
| [`POST /images/edits`](/api-reference/images/edit)           | Edit images using text instructions        |
| [`POST /videos`](/api-reference/videos/generate)             | Generate videos from text or image prompts |
| [`GET /videos/{id}`](/api-reference/videos/get)              | Get video generation status and output     |
| [`GET /models`](/api-reference/models/list)                  | List available models                      |
| [`GET /models/{id}`](/api-reference/models/get)              | Get details about a specific model         |

All endpoints are served under the base URL:

```
https://api.lumenfall.ai/openai/v1
```

## Using OpenAI SDKs

Any official OpenAI SDK works with Lumenfall. Configure the base URL and use your Lumenfall API key:

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="lmnfl_your_api_key",
      base_url="https://api.lumenfall.ai/openai/v1"
  )

  # Chat completion
  response = client.chat.completions.create(
      model="google/gemini-3-flash-preview",
      messages=[{"role": "user", "content": "Why are capybaras so chill?"}]
  )

  # Image generation
  response = client.images.generate(
      model="gemini-3-pro-image",
      prompt="A capybara relaxing in a hot spring"
  )

  # Video generation (async - returns immediately)
  video = client.videos.create(
      model="sora-2",
      prompt="A capybara swimming in a pool",
      seconds=5,
  )
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: "lmnfl_your_api_key",
    baseURL: "https://api.lumenfall.ai/openai/v1",
  });

  // Chat completion
  const chat = await client.chat.completions.create({
    model: "google/gemini-3-flash-preview",
    messages: [{ role: "user", content: "Why are capybaras so chill?" }],
  });

  // Image generation
  const image = await client.images.generate({
    model: "gemini-3-pro-image",
    prompt: "A capybara relaxing in a hot spring",
  });

  // Video generation (async - returns immediately)
  const video = await client.videos.create({
    model: "sora-2",
    prompt: "A capybara swimming in a pool",
    seconds: 5,
  });
  ```
</CodeGroup>

See the [OpenAI SDK guide](/client-libraries/openai-sdk) for complete examples in all supported languages.

<Tip>
  **Provider-specific parameters**: Any parameters not part of the standard OpenAI API are passed through to the upstream provider. This lets you use provider-specific features like `seed` without waiting for explicit support. See [Passing additional parameters](/client-libraries/openai-sdk#passing-additional-parameters).
</Tip>

## Environment variables

You can configure most OpenAI-compatible tools using environment variables:

```bash theme={null}
export OPENAI_API_KEY="lmnfl_your_api_key"
export OPENAI_BASE_URL="https://api.lumenfall.ai/openai/v1"
```

## Errors

Lumenfall returns errors using the same format and codes as the [OpenAI API](https://platform.openai.com/docs/guides/error-codes). Provider-specific errors are transformed to match OpenAI's error structure, so your existing error handling works without changes.

See [Unified Model Behavior](/unified-model-behavior#error-normalization) for details on how errors are normalized across providers.

## Next steps

<CardGroup cols={2}>
  <Card title="Unified Model Behavior" icon="layer-group" href="/unified-model-behavior">
    Learn how Lumenfall ensures consistent behavior across all models.
  </Card>

  <Card title="Available Models" icon="cube" href="/models">
    Explore all available models.
  </Card>
</CardGroup>
