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

# Quickstart

> From your first API key to your first response.

For Claude, ChatGPT or Codex, use the [MCP quickstart](/mcp/quickstart).

<Steps>
  <Step title="Get your API key">
    Create a key at [Developers → Keys](https://www.ninjachat.ai/developers/keys). Keys look like `nj_sk_...` and are shown once — copy immediately.
  </Step>

  <Step title="Install an SDK">
    <CodeGroup>
      ```bash TypeScript theme={null}
      npm install @ninjachat/sdk
      ```

      ```bash Python theme={null}
      pip install ninjachat
      ```
    </CodeGroup>
  </Step>

  <Step title="Put the key in your environment">
    ```bash theme={null}
    export NINJACHAT_API_KEY='nj_sk_your-api-key-here'
    ```
  </Step>

  <Step title="Make your first request">
    Set `model` to `ninja/auto` and NinjaChat picks the best model for you.

    <CodeGroup>
      ```typescript TypeScript theme={null}
      import { NinjaChat } from "@ninjachat/sdk";

      const client = new NinjaChat({
        apiKey: process.env.NINJACHAT_API_KEY!,
      });

      const response = await client.responses.create({
        model: "ninja/auto",
        input: "What is the capital of France?",
      });

      console.log(response.output_text);
      ```

      ```python Python theme={null}
      import os
      from ninjachat import NinjaChat

      client = NinjaChat(api_key=os.environ["NINJACHAT_API_KEY"])
      response = client.responses.create(
          model="ninja/auto",
          input="What is the capital of France?",
      )
      print(response["output_text"])
      ```

      ```bash cURL theme={null}
      curl https://www.ninjachat.ai/api/v1/responses \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer $NINJACHAT_API_KEY" \
        -d '{
          "model": "ninja/auto",
          "input": "What is the capital of France?"
        }'
      ```
    </CodeGroup>
  </Step>

  <Step title="Read the response">
    Read the answer from `output_text`. Check `model`, `cost_usd` and `request_id` for the model used, cost and request trace.

    <Accordion title="Example response and routing details">
      ```json theme={null}
      {
        "id": "resp_...",
        "object": "response",
        "status": "completed",
        "model": "gemini-3-flash",
        "output_text": "The capital of France is Paris.",
        "cost_usd": 0.00003,
        "provider": "google",
        "request_id": "req_...",
        "routing": {
          "strategy": "balanced",
          "requested_models": ["ninja/auto"],
          "resolved_model": "gemini-3-flash",
          "provider": "google",
          "fallbacks_allowed": true,
          "data_policy": "default",
          "router": {
            "id": "ninja/auto",
            "task": "factual",
            "classified_by": "regex",
            "candidates": ["gemini-3-flash", "..."]
          }
        }
      }
      ```

      `model` is the concrete model the router chose — the same value as `routing.resolved_model` — while `routing.requested_models` keeps the `ninja/auto` you asked for. `routing.router` explains the pick: the detected task, how it was classified (`regex`, `llm`, or `llm-cached`), and the ranked candidate chain. The sample is trimmed; see [Smart routing](/smart-routing) for the full block.
    </Accordion>
  </Step>
</Steps>

<Tip>
  Need streaming, images, video, usage, or request traces? Continue to the [SDK guide](/sdks). Already using the OpenAI SDK? [Change two lines](/openai-compatibility).
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="SDKs" icon="code" href="/sdks">
    TypeScript and Python clients
  </Card>

  <Card title="Smart Routing" icon="route" href="/smart-routing">
    `ninja/auto` plus cost, latency, and quality routing
  </Card>

  <Card title="Choose a model" icon="boxes-stacked" href="/models-overview">
    Frontier chat, image, and video models
  </Card>

  <Card title="Observability" icon="chart-line" href="/observability">
    Request traces, usage, balance, health, and webhooks
  </Card>

  <Card title="Go live" icon="rocket" href="/production-readiness">
    Reliability, spend controls, and launch checks
  </Card>

  <Card title="Pricing" icon="receipt" href="/pricing">
    Live token and media rates
  </Card>
</CardGroup>
