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

# Inference quickstart

> Install the SDK, authenticate, and send your first inference request to SynapsAI Cloud

Run inference against your deployed models with the Python SDK, cURL, or any OpenAI-compatible client. The API follows industry-standard formats — LLM endpoints match OpenAI's `v1/chat/completions` and `v1/completions`, and embeddings match `v1/embeddings`.

<Tip>
  Test requests interactively in the [Playground](https://platform.synapsai.cloud/playground) and copy the generated code into your application.
</Tip>

## Installation

Install the Python SDK:

```bash theme={null}
pip install --upgrade synapsai-python
```

## Authentication

Initialize the client or send a request with your [API key](/manage/api-keys). Treat the key like a password.

<Card href="https://platform.synapsai.cloud/apikeys" title="Create and manage API keys" icon="key" />

Set the environment variable:

<CodeGroup>
  ```bash Windows theme={null}
  set SYNAPSAI_API_KEY=your-api-key
  ```

  ```bash Linux/macOS theme={null}
  export SYNAPSAI_API_KEY=your-api-key
  ```
</CodeGroup>

### Initialize the client

<CodeGroup>
  ```python Python theme={null}
  from synapsai import SynapsAI

  client = SynapsAI()  # reads SYNAPSAI_API_KEY from the environment
  # or
  client = SynapsAI("your-api-key")
  ```

  ```bash cURL theme={null}
  curl https://api.synapsai.cloud/v1/models \
    -H "Authorization: Bearer $SYNAPSAI_API_KEY"
  ```
</CodeGroup>

## Send a request

Replace `your-model-id` with the ID from the [Models](https://platform.synapsai.cloud/models) page (click **Model ID** on your deployment).

<CodeGroup>
  ```python Python theme={null}
  response = client.chat.completions.create(
      model="your-model-id",
      messages=[
          {"role": "user", "content": "Hello, how are you?"}
      ],
  )

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

  ```bash cURL theme={null}
  curl -X POST https://api.synapsai.cloud/v1/chat/completions \
    -H "Authorization: Bearer $SYNAPSAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "your-model-id",
      "messages": [{"role": "user", "content": "Hello, how are you?"}]
    }'
  ```
</CodeGroup>

## Stream a response

Add `stream=True` to receive tokens as they are generated:

```python theme={null}
stream = client.chat.completions.create(
    model="your-model-id",
    messages=[{"role": "user", "content": "Hello, how are you?"}],
    stream=True,
)

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

See [Streaming](/guides/streaming) for SSE format details and production tips.

## Next steps

* Browse [Examples](/examples/introduction) for every supported pipeline task.
* [Migrate from OpenAI](/guides/migrate-from-openai) if you already use OpenAI-compatible libraries.
* Read the [API overview](/api-reference/introduction) for errors, rate limits, and endpoint compatibility.
