> ## 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 API Frequently Asked Questions and Answers

> Find quick answers to the most common questions about Swytcho's API, pricing, models, rate limits, data privacy, and production readiness.

Find answers to the questions developers ask most often when building with the Swytcho API. If you don't see your question here, reach out via [support](https://app.swytcho.com/support) or join the community on [Discord](https://discord.gg/swytcho).

<AccordionGroup>
  <Accordion title="How do I get an API key?">
    Sign up for a free account at [app.swytcho.com](https://app.swytcho.com), navigate to **API Keys** in the left sidebar, and click **Create new key**. Copy the key immediately — for security reasons, Swytcho only displays it once.

    Store your key in an environment variable (e.g. `SWYTCHO_API_KEY`) and never hard-code it in source files or commit it to version control. If a key is compromised, rotate it instantly from the same page.
  </Accordion>

  <Accordion title="Is Swytcho compatible with the OpenAI SDK?">
    Yes. Swytcho implements the same REST API contract as OpenAI's Chat Completions, Embeddings, and Models endpoints. To switch an existing OpenAI integration, set the `base_url` (Python) or `baseURL` (Node.js) parameter to `https://api.swytcho.com/v1` and replace your OpenAI key with your Swytcho key.

    ```python theme={null}
    from openai import OpenAI

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

    No other code changes are required in most cases. See the [SDKs page](/resources/sdks) for a full walkthrough.
  </Accordion>

  <Accordion title="What AI models are available?">
    Swytcho provides access to a curated set of leading models from multiple providers through a single API — including models from OpenAI, Anthropic, Google, Meta, and Mistral. The full up-to-date list is available via the [models endpoint](/api-reference/models) or the **Models** page in your dashboard.

    Different models have different context lengths, pricing tiers, and capabilities (chat, embeddings, vision, tool use). Check the model card for each one to choose the best fit for your workload.
  </Accordion>

  <Accordion title="How is pricing calculated?">
    Swytcho charges per token — separately for input (prompt) tokens and output (completion) tokens. Prices vary by model and are listed on the [Pricing page](https://swytcho.com/pricing).

    A few things to keep in mind:

    * System prompts, few-shot examples, and conversation history all count as input tokens.
    * Streaming responses are billed identically to non-streaming responses.
    * Your dashboard shows real-time usage and a per-day cost breakdown so you can monitor spend before surprises appear on your invoice.
  </Accordion>

  <Accordion title="What is the maximum context length?">
    Context length depends on the model you select. Most models support at least 8 000 tokens, several support 128 000 tokens, and some frontier models support up to 1 000 000 tokens. Check the **context\_window** field returned by the [models endpoint](/api-reference/models) for the exact limit of each model.

    If your request (prompt + max\_tokens) exceeds the model's context window, the API returns a `400` error. Truncate your input or switch to a model with a larger context window.
  </Accordion>

  <Accordion title="How do I reduce my API costs?">
    Several techniques can meaningfully lower your token spend:

    * **Choose the right model.** Smaller, cheaper models (e.g. GPT-4o mini, Mistral 7B) handle many tasks just as well as larger ones at a fraction of the cost.
    * **Trim your system prompt.** Every token in every request costs money. Keep system prompts concise and remove boilerplate.
    * **Truncate conversation history.** In multi-turn applications, only send the last N turns instead of the full history.
    * **Set `max_tokens` explicitly.** Cap the output length to avoid unexpectedly long completions.
    * **Cache repeated prompts.** If you send the same prompt many times (e.g. a classification prefix), consider caching responses at the application layer.

    <Tip>
      Use the `usage` field in every API response to track exact token counts per request and identify expensive call sites in your code.
    </Tip>
  </Accordion>

  <Accordion title="Can I use Swytcho for production workloads?">
    Yes. Swytcho is designed for production use and operates with a 99.9% uptime SLA on paid plans. Infrastructure is distributed across multiple regions with automatic failover.

    For production deployments, we recommend:

    * Using a server-side environment to keep your API key secure.
    * Implementing retry logic with exponential backoff for transient `5xx` errors.
    * Monitoring the [Swytcho status page](https://status.swytcho.com) or subscribing to incident notifications.
    * Setting up usage alerts in the dashboard to avoid unexpected overages.
  </Accordion>

  <Accordion title="How do I report a bug or request a feature?">
    **Bugs:** Open an issue in the relevant GitHub repository — [swytcho-python](https://github.com/swytcho/swytcho-python) or [swytcho-node](https://github.com/swytcho/swytcho-node) — or email [support@swytcho.com](mailto:support@swytcho.com) with a minimal reproduction.

    **Feature requests:** Post in the **#feature-requests** channel on [Discord](https://discord.gg/swytcho) or use the feedback form in the dashboard. Upvoting existing requests is the fastest way to surface them to the product team.

    To help the team investigate quickly, include your account region, the model name, a sanitised request/response pair, and the `request-id` response header value from the failed request.
  </Accordion>

  <Accordion title="What happens if my request exceeds the rate limit?">
    When you exceed your rate limit, the API returns a `429 Too Many Requests` response immediately — your request is not queued. The response includes a `Retry-After` header indicating how many seconds to wait before trying again.

    To handle this gracefully:

    ```python theme={null}
    import time
    import swytcho
    from swytcho import RateLimitError

    def call_with_backoff(client, **kwargs):
        for attempt in range(4):
            try:
                return client.chat.completions.create(**kwargs)
            except RateLimitError as e:
                wait = int(e.response.headers.get("Retry-After", 2 ** attempt))
                time.sleep(wait)
        raise RuntimeError("Rate limit retries exhausted")
    ```

    If you consistently hit rate limits, consider upgrading your plan or batching requests. Current limits are displayed on the **Usage** page in your dashboard.
  </Accordion>

  <Accordion title="Does Swytcho store my prompts or completions?">
    By default, Swytcho retains request and response data for **30 days** to support debugging and abuse detection. You can opt out of retention entirely in **Settings → Privacy** in the dashboard, or by setting the `X-Swytcho-No-Store: true` request header on a per-request basis.

    <Note>
      Opting out of data retention disables the request inspector and replay tools in the dashboard for those requests.
    </Note>

    Swytcho does not use your data to train models. For details on how data is handled, processed, and protected, see the [Privacy Policy](https://swytcho.com/privacy) and [Terms of Service](https://swytcho.com/terms).
  </Accordion>
</AccordionGroup>
