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

> ## Agent Instructions
> The Venice API is OpenAI-compatible: use any OpenAI SDK with the base URL `https://api.venice.ai/api/v1` and a Venice API key, or pay per request from a USDC wallet through x402 with no account.
> Read model IDs from `GET /models` or `GET /models/traits` at runtime instead of hardcoding them from memory or from these pages. Models are added and retired often.
> Every model's price is in https://docs.venice.ai/pricing.md. Quote video and audio jobs with `POST /video/quote` or `POST /audio/quote` before you queue them.
> Search these docs from an MCP client at https://docs.venice.ai/mcp. The full agent guide is https://docs.venice.ai/agents.md.

# Quickstart

> Generate a Venice API key, install the OpenAI-compatible SDK, and send your first chat completion request to api.venice.ai in minutes.

Get up and running with the Venice API in minutes. Generate an API key, make your first request, and start building.

## Quickstart

**1. Get your API key**

Head to your [Venice API Settings](https://venice.ai/settings/api?utm_source=venice-api-documentation) and generate a new API key.

For a detailed walkthrough, check out the [API Key guide](https://docs.venice.ai/guides/getting-started/generating-api-key.md).

**2. Add credits**

API requests are paid per use from your account balance, so add one before your first request: buy USD credits by card or crypto on the same [API settings](https://venice.ai/settings/api?utm_source=venice-api-documentation) page, or stake [DIEM](https://docs.venice.ai/overview/vvv-diem.md) for a daily allowance. Paid Venice plans also include a monthly API credit allowance. Without a balance, requests return `402` with `INSUFFICIENT_BALANCE`. See [paying for usage](https://docs.venice.ai/pricing#paying-for-usage).

**3. Set up your API key**

Add your API key to your environment. To set it in your shell, open a terminal and run the command for your operating system, replacing the placeholder with your key:

```bash macOS / Linux theme={"system"}
export VENICE_API_KEY=your-api-key-here
```

```powershell Windows (PowerShell) theme={"system"}
$env:VENICE_API_KEY = "your-api-key-here"
```

```bat Windows (Command Prompt, persisted) theme={"system"}
setx VENICE_API_KEY your-api-key-here
```

Restart the terminal after `setx` so the new variable is available.

Or add it to a `.env` file in your project:

```bash theme={"system"}
VENICE_API_KEY=your-api-key-here
```

Standalone scripts like the samples below don't read `.env` on their own, so load the file before you run them:

* **Python:** `pip install python-dotenv`, then call `load_dotenv()` from `dotenv` before you create the client.
* **Node.js:** run the script with `node --env-file=.env index.mjs` (Node.js 20.6 or later).
* **cURL:** load the file into your shell first with `set -a; source .env; set +a`.

> [!NOTE]
>
> Paste the key exactly as Venice issued it. Do not include a `Bearer` prefix. In the `export` and `.env` forms, keep it on a single line with no quotes and no spaces around the `=`. The same applies when you paste the key into an API-key field in a tool such as Cursor, Cline, or Jan. A clipped character or a stray space is the most common cause of a `401` on a brand-new key.

**4. Install the SDK**

Venice is OpenAI-compatible, so you can use the OpenAI SDK. If you prefer to use cURL or raw HTTP requests, you can skip this step.

```bash Python theme={"system"}
pip install openai
```

```bash Node.js theme={"system"}
npm install openai
```

**5. Send your first request**

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

client = OpenAI(
    api_key=os.getenv("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "system", "content": "You are a helpful AI assistant"},
        {"role": "user", "content": "Why is privacy important?"}
    ]
)

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

```javascript Node.js theme={"system"}
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'system', content: 'You are a helpful AI assistant' },
        { role: 'user', content: 'Why is privacy important?' }
    ]
});

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

```bash cURL theme={"system"}
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "system", "content": "You are a helpful AI assistant"},
      {"role": "user", "content": "Why is privacy important?"}
    ]
  }'
```

**Message roles:**

* `system` - Instructions for how the model should behave
* `user` - Your prompts or questions
* `assistant` - Previous model responses (for multi-turn conversations)
* `tool` - Function calling results (when using tools)

**6. Switch models by changing the model ID**

Every request includes a `model` ID. To use a different model, change the `model` value in your request. Popular choices:

* `zai-org-glm-5` - Default model for most use cases
* `kimi-k2-6` - Strong reasoning for more complex tasks
* `claude-opus-4-8` - High-intelligence model for complex tasks
* `venice-uncensored-1-2` - Venice's uncensored model

> [card] [View All Models](https://docs.venice.ai/overview/models.md)
>
> Browse the complete list of models with pricing, capabilities, and context limits

**7. Use Venice Parameters**

You can choose to enable Venice-specific features like web search using `venice_parameters`:

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

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "user", "content": "What are the latest developments in AI?"}
    ],
    extra_body={
        "venice_parameters": {
            "enable_web_search": "auto",
            "include_venice_system_prompt": True
        }
    }
)

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

```javascript Node.js theme={"system"}
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'user', content: 'What are the latest developments in AI?' }
    ],
    venice_parameters: {
        enable_web_search: 'auto',
        include_venice_system_prompt: true
    }
});

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

```bash cURL theme={"system"}
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "user", "content": "What are the latest developments in AI?"}
    ],
    "venice_parameters": {
      "enable_web_search": "auto",
      "include_venice_system_prompt": true
    }
  }'
```

See all [available parameters](https://docs.venice.ai/api-reference/api-spec.md#venice-parameters).

**8. Enable streaming (optional)**

Stream responses in real-time using `stream=True`:

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

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

stream = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[{"role": "user", "content": "Write a short story about AI"}],
    stream=True
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
```

```javascript Node.js theme={"system"}
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const stream = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [{ role: 'user', content: 'Write a short story about AI' }],
    stream: true
});

for await (const chunk of stream) {
    if (chunk.choices && chunk.choices[0]?.delta?.content) {
        process.stdout.write(chunk.choices[0].delta.content);
    }
}
```

```bash cURL theme={"system"}
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "user", "content": "Write a short story about AI"}
    ],
    "stream": true
  }'
```

**9. Customize response behavior (optional)**

Control how the model responds with parameters like temperature, max tokens, and more:

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

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "system", "content": "You are a creative storyteller"},
        {"role": "user", "content": "Tell me a creative story"}
    ],
    temperature=0.8,
    max_tokens=500,
    top_p=0.9,
    frequency_penalty=0.5,
    presence_penalty=0.5,
    extra_body={
        "venice_parameters": {
            "include_venice_system_prompt": False
        }
    }
)

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

```javascript Node.js theme={"system"}
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'system', content: 'You are a creative storyteller' },
        { role: 'user', content: 'Tell me a creative story' }
    ],
    temperature: 0.8,
    max_tokens: 500,
    top_p: 0.9,
    frequency_penalty: 0.5,
    presence_penalty: 0.5,
    venice_parameters: {
        include_venice_system_prompt: false
    }
});

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

```bash cURL theme={"system"}
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "system", "content": "You are a creative storyteller"},
      {"role": "user", "content": "Tell me a creative story"}
    ],
    "temperature": 0.8,
    "max_tokens": 500,
    "top_p": 0.9,
    "frequency_penalty": 0.5,
    "presence_penalty": 0.5,
    "stream": false,
    "venice_parameters": {
      "include_venice_system_prompt": false
    }
  }'
```

Check out the [Chat Completions docs](https://docs.venice.ai/api-reference/endpoint/chat/completions.md) for more information on all supported parameters.

***

## Next Steps

Now that you've made your first requests, explore more of what Venice API has to offer:

> [card] [Browse Models](https://docs.venice.ai/overview/models.md)
>
> Compare all available models with their capabilities, pricing, and context limits

> [card] [API Reference](https://docs.venice.ai/api-reference/api-spec.md)
>
> Explore detailed API documentation with all endpoints and parameters

> [card] [Structured Responses](https://docs.venice.ai/guides/features/structured-responses.md)
>
> Learn how to get JSON responses with guaranteed schemas

> [card] [AI Agents Guide](https://docs.venice.ai/guides/integrations/ai-agents.md)
>
> Build with agent apps, coding agents, MCP tools, skills, and crypto workflows

### Additional Resources

> [card] [Rate Limiting](https://docs.venice.ai/api-reference/rate-limiting.md)
>
> Understand rate limits and best practices for production usage

> [card] [Error Codes](https://docs.venice.ai/api-reference/error-codes.md)
>
> Reference for handling API errors and troubleshooting issues

> [card] [Postman Collection](https://docs.venice.ai/guides/getting-started/postman.md)
>
> Import our complete Postman collection for easy testing

> [card] [Privacy & Security](https://docs.venice.ai/overview/privacy.md)
>
> Learn about Venice's privacy-first architecture and data handling

***

## Need Help?

* **Discord Community**: Join our [Discord server](https://discord.gg/askvenice) for support and discussions
* **Documentation**: Browse our [complete API reference](https://docs.venice.ai/api-reference/api-spec.md)
* **Status Page**: Check service status at [veniceai-status.com](https://veniceai-status.com)
* **Twitter**: Follow [@veniceai](https://x.com/veniceai) for updates


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.