> ## 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.

# OpenAI SDK Compatibility: Use Swytcho as a Drop-In

> Swytcho's API is fully OpenAI-compatible — swap your base URL and API key to access every Swytcho model through the SDK you already use.

Swytcho's API is fully compatible with the OpenAI SDK. You don't need to learn a new client library or rewrite existing code — just update your `base_url` and API key to point at Swytcho, and every SDK call works exactly as before. This makes Swytcho a true drop-in replacement for OpenAI, and means you can migrate incrementally: route one model or one feature at a time while leaving the rest of your application untouched.

## Configure the OpenAI SDK

Set `base_url` (Python) or `baseURL` (Node.js) to `https://api.swytcho.com/v1` and replace your OpenAI API key with your Swytcho API key. Everything else stays the same.

<CodeGroup>
  ```python 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-1",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "What is the Swytcho API?"},
      ],
  )

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

  ```javascript 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-1",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "What is the Swytcho API?" },
    ],
  });

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

## Supported Endpoints

Swytcho supports the following OpenAI-compatible endpoints:

| Endpoint                    | Description                       |
| --------------------------- | --------------------------------- |
| `POST /v1/chat/completions` | Generate chat-based completions   |
| `POST /v1/completions`      | Generate text completions         |
| `POST /v1/embeddings`       | Create vector embeddings          |
| `GET /v1/models`            | List all available Swytcho models |

## Differences from OpenAI

Swytcho is designed to be a seamless replacement, but there is one key difference to keep in mind: **model names**. Swytcho hosts its own model lineup — you pass Swytcho model names (such as `swytcho-1`) where you would otherwise pass `gpt-4o` or another OpenAI model name.

<Note>
  Use `GET /v1/models` to retrieve the full list of models currently available on your Swytcho account. The response follows the same schema as OpenAI's models endpoint, so any tooling that parses that format will work without modification.
</Note>

All request and response schemas — including streaming, function calling, and role-based messages — match the OpenAI spec exactly. If you find a discrepancy, [contact support](mailto:support@swytcho.com).
