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

# Orq SDKs

> Install and configure the official Orq.ai SDKs for Python and Node.js. Authenticate with your API key and start making API calls in minutes.

We recommend to use our official client libraries to interact with the **orq.ai API.**

## Github

Our SDKs are available on **Github**:

<CardGroup cols={2}>
  <Card title="Node.js" icon="node-js" href="https://github.com/orq-ai/orq-node/tree/main" cta="Get started with our Node.js SDK" />

  <Card title="Python" icon="python" href="https://github.com/orq-ai/orq-python/tree/main" cta="Get started with our Python SDK" />
</CardGroup>

## Installation

<CodeGroup>
  ```bash Bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  # The SDK can be installed with either pip or poetry package managers.
  # PIP

  pip install orq-ai-sdk

  # Poetry

  poetry add orq-ai-sdk
  ```

  ```bash NPM theme={"theme":{"light":"github-light","dark":"github-dark"}}
  # The SDK can be installed with either npm, pnpm, bun or yarn package managers.
  # NPM

  npm add @orq-ai/node

  # PNPM

  pnpm add @orq-ai/node

  # Bun

  bun add @orq-ai/node

  # Yarn

  yarn add @orq-ai/node zod

  # Note that Yarn does not install peer dependencies automatically. You will need
  # to install zod as shown above.
  ```
</CodeGroup>

## Usage

<Info>
  To get your workspace API Keys, see [API Keys](/docs/administer/api-keys).
</Info>

Initialize the orq.ai client with your API key:

<CodeGroup>
  ```bash Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os

  from orq_ai_sdk import Orq

  client = Orq(
  	 api_key=os.environ.get("ORQ_API_KEY", "__API_KEY__"),
   	 environment="production",
     # optionally initiate the identity_id for the session
     identity_id=2025
  )
  ```

  ```bash Javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { Orq } from "@orq-ai/node";

  const client = new Orq({
    apiKey: 'orq-api-key',
    environment: 'production',
    // Optionally initiate the identityId for the session
    identityId: 2025
  });
  ```
</CodeGroup>

<Warning>
  If environment is provided in the SDK initialization, it will be set as the global environment for every request to [Deployments Invoke](/reference/deployments/invoke), [Get config](/reference/deployments/get-config), and [Retrieve a remote config](/reference/remote-configs/retrieve-a-remote-config) even if the context contains an environment property.
</Warning>

## Deployments

The Deployments API delivers text outputs, images, or tool calls based on the configuration established within orq.ai for your deployments. Additionally, this API supports streaming. It is highly recommended that you use the code snippets from the orq.ai Organization panel to ensure ease of use and minimize errors.

### Invoke a deployment

#### `invoke()`

<CodeGroup>
  ```bash Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  generation = client.deployments.invoke(
      key="customer_service",
      context={"environments": "production", "country": "NLD"},
      inputs={"firstname": "John", "city": "New York"},
      metadata={"customer_id": "Qwtqwty90281"},
  )

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

  ```bash Javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const deployment = await client.deployments.invoke({
    key: 'customer_service',
    context: { environments: 'production', country: 'NLD' },
    inputs: { firstname: 'John', city: 'New York' },
    metadata: { customer_id: 'Qwtqwty90281' },
  });

  console.log(deployment?.choices[0].message.content);
  ```
</CodeGroup>

<Info>
  Learn more about Invoke() reading the [Python](https://github.com/orq-ai/orq-python/blob/main/docs/sdks/deployments/README.md#invoke) and [Node.js](https://github.com/orq-ai/orq-node/blob/main/docs/sdks/deployments/README.md#invoke) docs.
</Info>

**Deployments** can also be streamed:

* using [**stream() with the Python SDK**](https://github.com/orq-ai/orq-python/blob/main/docs/sdks/deployments/README.md#stream)
* using [**stream() with the Node.js**](https://github.com/orq-ai/orq-node/blob/main/docs/sdks/deployments/README.md#stream)

Read more about using the SDK to interact with the **Deployments API** with [**Python**](https://github.com/orq-ai/orq-python/blob/main/docs/sdks/deployments/README.md) and [**Node.js**](https://github.com/orq-ai/orq-node/blob/main/docs/sdks/deployments/README.md).

## Other Resources and Operations

Read more on the Github SDK Documentation for all Resources and Operations:

### [All available Resources and Operations for Python](https://github.com/orq-ai/orq-python?tab=readme-ov-file#available-resources-and-operations)

### [All available Resources and Operations for Node.js](https://github.com/orq-ai/orq-node/tree/main?tab=readme-ov-file#available-resources-and-operations)
