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

# Quickstart

> Send your first Cogito request in under five minutes.

## 1. Get an API key

Sign in at [cogito.decart.ai](https://cogito.decart.ai), then create a key from **Dashboard → API keys**. Copy it once — we never show the full secret again.

```bash theme={null}
export COGITO_API_KEY="cog-live-..."
```

## 2. Send a request

Cogito is OpenAI-compatible. Use the OpenAI SDK in any language; just point `base_url` at `https://api.cogito.decart.ai/v1`.

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.cogito.decart.ai/v1/chat/completions \
    -H "Authorization: Bearer $COGITO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "deepseek-v4-flash",
      "messages": [
        { "role": "user", "content": "Why is the sky blue?" }
      ]
    }'
  ```

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

  client = OpenAI(
      base_url="https://api.cogito.decart.ai/v1",
      api_key=os.environ["COGITO_API_KEY"],
  )

  response = client.chat.completions.create(
      model="deepseek-v4-flash",
      messages=[{"role": "user", "content": "Why is the sky blue?"}],
  )

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

  ```typescript node theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://api.cogito.decart.ai/v1",
    apiKey: process.env.COGITO_API_KEY,
  });

  const response = await client.chat.completions.create({
    model: "deepseek-v4-flash",
    messages: [{ role: "user", content: "Why is the sky blue?" }],
  });

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

## 3. Stream tokens

Add `stream: true` to receive an SSE stream of OpenAI-compatible chunks.

<CodeGroup>
  ```python python theme={null}
  stream = client.chat.completions.create(
      model="deepseek-v4-flash",
      messages=[{"role": "user", "content": "Why is the sky blue?"}],
      stream=True,
  )

  for chunk in stream:
      print(chunk.choices[0].delta.content or "", end="", flush=True)
  ```

  ```typescript node theme={null}
  const stream = await client.chat.completions.create({
    model: "deepseek-v4-flash",
    messages: [{ role: "user", content: "Why is the sky blue?" }],
    stream: true,
  });

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

## Next

* [Authentication](/getting-started/authentication) — keys, scopes, header format
* [Streaming](/guides/streaming) — backpressure, cancellation, error recovery
* [Function calling](/guides/function-calling) — tools, parallel calls, JSON arguments
* [Structured outputs](/guides/structured-outputs) — guaranteed JSON schema adherence
* [Model catalog](/getting-started/models) — what's available, what's coming
