> ## Documentation Index
> Fetch the complete documentation index at: https://veniceai-mintlify-86b9f77a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from OpenAI

> Move OpenAI-compatible apps to Venice by swapping the base URL to api.venice.ai and your API key for private, uncensored inference with the same SDK.

Venice AI is a **drop-in replacement** for OpenAI. Same SDK, same code — just change two lines. Get privacy-first inference, uncensored models, and competitive pricing.

## The 2-Line Migration

<CodeGroup>
  ```python Python theme={null}
  # Before (OpenAI)
  from openai import OpenAI
  client = OpenAI()

  # After (Venice) — change api_key and base_url
  from openai import OpenAI
  client = OpenAI(
      api_key="your-venice-api-key",           # ← Change 1
      base_url="https://api.venice.ai/api/v1",  # ← Change 2
  )
  ```

  ```javascript Node.js theme={null}
  // Before (OpenAI)
  import OpenAI from "openai";
  const client = new OpenAI();

  // After (Venice)
  import OpenAI from "openai";
  const client = new OpenAI({
    apiKey: "your-venice-api-key",
    baseURL: "https://api.venice.ai/api/v1",
  });
  ```

  ```bash cURL theme={null}
  # Before
  curl https://api.openai.com/v1/chat/completions ...

  # After — just change the URL and key
  curl https://api.venice.ai/api/v1/chat/completions ...
  ```
</CodeGroup>

Generate a key from [venice.ai/settings/api](https://venice.ai/settings/api?utm_source=venice-api-documentation) or follow the [API key guide](/guides/getting-started/generating-api-key).

### Environment variables

```bash theme={null}
# Before
OPENAI_API_KEY=sk-...
OPENAI_BASE_URL=https://api.openai.com/v1

# After
OPENAI_API_KEY=your-venice-api-key
OPENAI_BASE_URL=https://api.venice.ai/api/v1
```

<Tip>
  Many libraries and tools read `OPENAI_API_KEY` and `OPENAI_BASE_URL` automatically. Updating these env vars may be all you need. Some tools still use `OPENAI_API_BASE` for the same URL.
</Tip>

## Models

Pass a Venice model ID, a trait such as `default` or `most_uncensored`, or a familiar OpenAI-style name. Venice maps OpenAI names through [compatibility mapping](/api-reference/endpoint/models/compatibility_mapping). Traits always resolve to the current model for that role — see [model traits](/api-reference/endpoint/models/traits).

Browse the live catalog on [Text models](/models/text) and [Pricing](/overview/pricing). For a first-request walkthrough, see the [Quickstart](/getting-started/quick-start).

## Feature compatibility

| Feature           | OpenAI | Venice | Notes                                                                                                  |
| ----------------- | ------ | ------ | ------------------------------------------------------------------------------------------------------ |
| Chat Completions  | ✅      | ✅      | Fully compatible                                                                                       |
| Streaming         | ✅      | ✅      | Same SSE format                                                                                        |
| Function Calling  | ✅      | ✅      | Same `tools` parameter                                                                                 |
| Structured Output | ✅      | ✅      | Same `response_format`                                                                                 |
| Vision            | ✅      | ✅      | Same content array format                                                                              |
| Embeddings        | ✅      | ✅      | Text only; token arrays return HTTP 400                                                                |
| Image Generation  | ✅      | ✅      | OpenAI-compatible via `/images/generations`                                                            |
| TTS               | ✅      | ✅      | Compatible                                                                                             |
| STT               | ✅      | ✅      | Compatible                                                                                             |
| Responses API     | ✅      | ✅      | Alpha                                                                                                  |
| Assistants API    | ✅      | ❌      | Use [Characters](/guides/features/characters) or [function calling](/guides/features/function-calling) |
| Batch API         | ✅      | ❌      | Not yet available                                                                                      |
| Fine-tuning       | ✅      | ❌      | Not available                                                                                          |

For native image options beyond the OpenAI-compatible endpoint, see [Image generation](/guides/media/image-generation).

## Venice-only features

Pass Venice-specific options through `extra_body` as `venice_parameters`. Built-in web search is the usual first extra:

```python theme={null}
response = client.chat.completions.create(
    model="default",
    messages=[{"role": "user", "content": "Latest AI news today"}],
    extra_body={
        "venice_parameters": {
            "enable_web_search": "auto"
        }
    },
)
```

The same pattern covers web scraping, citations, and [Characters](/guides/features/characters). If a client cannot change the request body, append a [model feature suffix](/api-reference/endpoint/chat/model_feature_suffix) such as `default:enable_web_search=auto`.

Venice also has native [video](/guides/media/video-generation), [music](/guides/media/music-and-sound-effects), [web retrieval](/guides/tools/web-retrieval), and [x402](/guides/integrations/x402-venice-api) APIs alongside the OpenAI-compatible surface.

## Frameworks

Most AI frameworks work with Venice by changing the base URL:

<CardGroup cols={3}>
  <Card title="LangChain" icon="link" href="/guides/integrations/langchain">
    `base_url` in `ChatOpenAI`; `check_embedding_ctx_length=False` on `OpenAIEmbeddings`
  </Card>

  <Card title="Vercel AI SDK" icon="link" href="/guides/integrations/vercel-ai-sdk">
    `baseURL` in `createOpenAI`
  </Card>

  <Card title="LlamaIndex" icon="link" href="/guides/integrations/llamaindex">
    `api_base` on the OpenAI-compatible client
  </Card>

  <Card title="CrewAI" icon="link" href="/guides/integrations/crewai">
    `OPENAI_API_BASE` env var
  </Card>

  <Card title="PydanticAI" icon="link" href="/guides/integrations/pydanticai">
    OpenAI-compatible model with Venice base URL
  </Card>

  <Card title="Cursor" icon="link" href="/guides/integrations/cursor">
    Custom API endpoint in settings
  </Card>

  <Card title="Claude Code" icon="link" href="/guides/integrations/claude-code">
    Route Claude Code through Venice
  </Card>

  <Card title="Codex CLI" icon="link" href="/guides/integrations/codex-cli">
    `config.toml` model provider
  </Card>

  <Card title="Aider" icon="link" href="/guides/integrations/aider">
    `OPENAI_API_BASE` env var
  </Card>
</CardGroup>

More coding agents and tools are listed in [AI Agents](/guides/integrations/ai-agents).

## Uncensored models

Venice's private uncensored models have no content filtering, making them suitable for:

* Creative writing without guardrails
* Security research and red teaming
* Honest analysis without refusal patterns
* Medical and legal information without extra disclaimers

Use the `most_uncensored` trait or a current uncensored model ID from [Text models](/models/text).

<Card title="Get Your API Key" icon="key" href="https://venice.ai/settings/api?utm_source=venice-api-documentation">
  Generate a Venice API key and start migrating in minutes
</Card>
