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

# Getting Started

> Install the Nevermined Payments Library for TypeScript or Python, get your API key, and initialize the client to start monetizing your AI services.

This guide will help you set up and initialize the Nevermined Payment Libraries to start monetizing your AI services.

## Prerequisites

Before you begin, make sure you have:

<Steps>
  <Step title="Development Environment">
    * Node.js 16+ and npm/yarn (for TypeScript)
    * Python 3.8+ (for Python)
    * A code editor (VS Code recommended)
  </Step>

  <Step title="Nevermined API Key">
    [Get your API key](/docs/getting-started/get-your-api-key) from the Nevermined App
  </Step>

  <Step title="Test Tokens (Optional)">
    Some test tokens for testing (you can [get some USDC from here](https://faucet.circle.com/))
  </Step>
</Steps>

## Installation

<Tabs>
  <Tab title="TypeScript/JavaScript">
    ```bash theme={null}
    npm install @nevermined-io/payments
    # or
    yarn add @nevermined-io/payments
    ```
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    pip install payments-py
    ```
  </Tab>
</Tabs>

## Getting Your API Key

Follow the [Get Your API Key](/docs/getting-started/get-your-api-key) guide to create your Nevermined API key, then store it securely as an environment variable:

```bash theme={null}
export NVM_API_KEY="sandbox:your-api-key-here"
```

<Warning>
  Never expose your API key in client-side code or commit it to version control. Always use environment variables.
</Warning>

## Initialize the Payments Libraries

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { Payments } from '@nevermined-io/payments'

    const payments = Payments.getInstance({
      nvmApiKey: process.env.NVM_API_KEY,
      environment: 'sandbox' // or 'live'
    })
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    from payments_py import Payments, PaymentOptions

    payments = Payments.get_instance(
        PaymentOptions(
            nvm_api_key=os.environ.get('NVM_API_KEY'),
            environment='sandbox'  # or 'live'
        )
    )
    ```
  </Tab>
</Tabs>

## Environment Configuration

Choose the appropriate environment for your use case:

<AccordionGroup>
  <Accordion title="Sandbox Environment">
    * **Use case**: Development and testing
    * **Payments**: Test fiat and tokens (free)
    * **Environment**: `'sandbox'`
    * **Network**: [Base Sepolia testnet](https://sepolia.basescan.org/)
  </Accordion>

  <Accordion title="Live Environment">
    * **Use case**: Live applications
    * **Payments**: Fiat (via Stripe) and any ERC-20 tokens
    * **Environment**: `'live'`
    * **Network**: [Base](https://basescan.org/)
  </Accordion>
</AccordionGroup>

## Common Issues

<AccordionGroup>
  <Accordion title="Invalid API Key Error">
    Make sure your API key is correctly set in your environment variables and has the proper permissions.
  </Accordion>

  <Accordion title="Network Connection Issues">
    Check that you're using the correct environment ('sandbox' or 'live') and that your network connection is stable.
  </Accordion>
</AccordionGroup>

If you encounter any issues, check our [Frequently Asked Questions](/docs/development-guide/faq) or reach out to our community on [Discord](https://discord.com/invite/GZju2qScKq).
