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

# OpenAI-compatible

> Configure OpenAI-compatible model providers, credentials, base URLs, and request options for ViscribeAI.

## Bring your provider

ViscribeAI focuses on the image extraction workflow: source handling, strict
structured output, parsing, and typed results. You bring the model provider and
credentials that fit your stack.

The built-in clients use OpenAI-compatible Chat Completions. You can use the
default OpenAI SDK configuration or pass compatible client options for providers
that expose an OpenAI-style API.

<Card title="OpenAI Compatible" icon="https://mintcdn.com/viscribeai-147892a8/JRzEzplq6pig5sOk/assets/openai.svg?fit=max&auto=format&n=JRzEzplq6pig5sOk&q=85&s=57215096d5dd62f063565fdbcbf3ad98" width="16" height="16" data-path="assets/openai.svg">
  Use any vision-capable model provider that exposes an OpenAI-style Chat Completions API
  with image inputs and structured output.
</Card>

## Environment variables

For the default OpenAI client, store credentials in your environment.

```bash theme={null}
export OPENAI_API_KEY="sk-your-provider-key"
export OPENAI_MODEL="gpt-5-mini"
```

`OPENAI_MODEL` is only used by the examples in this repository. In application
code, pass the model explicitly through `model_config` or `modelConfig`.

## Python configuration

```python theme={null}
from viscribe.images import extract

result = extract(
    image_path="examples/receipt.png",
    output_schema=[{"name": "total_amount", "type": "number"}],
    model_config={
        "model": "gpt-5-mini",
        "api_key": "sk-your-provider-key",
        "base_url": "https://example-compatible-provider.com/v1",
        "temperature": 1,
        "max_retries": 2,
    },
)
```

Python client options such as `api_key`, `base_url`, `timeout`, and
`max_retries` are passed to the underlying OpenAI client. Other keys are sent
with the model request.

## TypeScript configuration

```ts theme={null}
import { images } from "viscribe";

const result = await images.extract({
  imagePath: "examples/receipt.png",
  outputSchema: [{ name: "total_amount", type: "number" }],
  modelConfig: {
    model: "gpt-5-mini",
    apiKey: "sk-your-provider-key",
    baseURL: "https://example-compatible-provider.com/v1",
    temperature: 1,
    maxRetries: 2,
  },
});
```

TypeScript client options such as `apiKey`, `baseURL`, `timeout`, and
`maxRetries` are passed to the underlying OpenAI client. Other keys are sent
with the model request.

<Note>
  Use a vision-capable model that supports image inputs and structured output through an
  OpenAI-compatible Chat Completions interface.
</Note>
