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

# Swytcho SDKs, Client Libraries, and REST API Guide

> Access Swytcho's unified AI API using official Python and Node.js SDKs, the OpenAI SDK, or plain HTTP requests from any language or framework.

Swytcho provides first-party SDKs for Python and Node.js, and is fully compatible with the OpenAI SDK — so if you already have an OpenAI integration, you can switch to Swytcho by changing a single base URL. No matter your stack, you can start making API calls in minutes.

<Note>
  The fastest way to get started is with the **OpenAI SDK**. Point it at Swytcho's base URL and your existing code works immediately — no new SDK required.
</Note>

## Available SDKs and Integrations

<CardGroup cols={2}>
  <Card title="Python SDK" icon="python" href="https://github.com/swytcho/swytcho-python">
    The official Swytcho Python library. Supports synchronous and async usage, streaming, and all Swytcho-specific features. Install with `pip`.
  </Card>

  <Card title="Node.js / TypeScript SDK" icon="js" href="https://github.com/swytcho/swytcho-node">
    The official Swytcho Node.js library with full TypeScript types. Works in Node.js, Deno, Bun, and edge runtimes. Install with `npm`, `yarn`, or `pnpm`.
  </Card>

  <Card title="Use the OpenAI SDK" icon="plug" href="/resources/sdks#openai-sdk-compatibility">
    Swytcho is fully OpenAI-compatible. Set `base_url` (Python) or `baseURL` (Node.js) to `https://api.swytcho.com/v1` and your existing OpenAI code works without further changes.
  </Card>

  <Card title="REST API" icon="code">
    Call Swytcho directly over HTTP from any language, tool, or platform. All you need is an API key and the ability to make a POST request.
  </Card>
</CardGroup>

***

## Installation

Install the official SDK for your language using your preferred package manager.

<CodeGroup>
  ```bash pip theme={null}
  pip install swytcho
  ```

  ```bash npm theme={null}
  npm install swytcho
  ```

  ```bash yarn theme={null}
  yarn add swytcho
  ```

  ```bash pnpm theme={null}
  pnpm add swytcho
  ```
</CodeGroup>

***

## Quick Start Examples

The examples below show how to send your first chat completion request using each integration path.

<CodeGroup>
  ```python Python SDK theme={null}
  from swytcho import Swytcho

  client = Swytcho(api_key="YOUR_API_KEY")

  response = client.chat.completions.create(
      model="swytcho/gpt-4o",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain quantum entanglement in one sentence."},
      ],
  )

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

  ```typescript Node.js / TypeScript SDK theme={null}
  import Swytcho from "swytcho";

  const client = new Swytcho({ apiKey: process.env.SWYTCHO_API_KEY });

  const response = await client.chat.completions.create({
    model: "swytcho/gpt-4o",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain quantum entanglement in one sentence." },
    ],
  });

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

  ```python OpenAI SDK (Python) theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_SWYTCHO_API_KEY",
      base_url="https://api.swytcho.com/v1",
  )

  response = client.chat.completions.create(
      model="swytcho/gpt-4o",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain quantum entanglement in one sentence."},
      ],
  )

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

  ```typescript OpenAI SDK (Node.js) theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.SWYTCHO_API_KEY,
    baseURL: "https://api.swytcho.com/v1",
  });

  const response = await client.chat.completions.create({
    model: "swytcho/gpt-4o",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain quantum entanglement in one sentence." },
    ],
  });

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

  ```bash REST API (curl) theme={null}
  curl https://api.swytcho.com/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "swytcho/gpt-4o",
      "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum entanglement in one sentence."}
      ]
    }'
  ```
</CodeGroup>

***

## Streaming Responses

All SDKs support streaming so you can display tokens as they are generated rather than waiting for the full response.

<CodeGroup>
  ```python Python SDK (streaming) theme={null}
  from swytcho import Swytcho

  client = Swytcho(api_key="YOUR_API_KEY")

  with client.chat.completions.stream(
      model="swytcho/gpt-4o",
      messages=[{"role": "user", "content": "Write a haiku about the ocean."}],
  ) as stream:
      for chunk in stream:
          print(chunk.choices[0].delta.content or "", end="", flush=True)
  ```

  ```typescript Node.js / TypeScript SDK (streaming) theme={null}
  import Swytcho from "swytcho";

  const client = new Swytcho({ apiKey: process.env.SWYTCHO_API_KEY });

  const stream = await client.chat.completions.create({
    model: "swytcho/gpt-4o",
    messages: [{ role: "user", content: "Write a haiku about the ocean." }],
    stream: true,
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
  }
  ```
</CodeGroup>

***

## Source Code and Contributions

Both official SDKs are open source. Explore the source, file issues, or contribute on GitHub.

<CardGroup cols={2}>
  <Card title="swytcho-python" icon="github" href="https://github.com/swytcho/swytcho-python">
    GitHub repository for the official Python SDK
  </Card>

  <Card title="swytcho-node" icon="github" href="https://github.com/swytcho/swytcho-node">
    GitHub repository for the official Node.js / TypeScript SDK
  </Card>
</CardGroup>
