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

# cURL / Python / Node.js

> Wywołaj API bezpośrednio za pomocą oficjalnych bibliotek OpenAI

Każda oficjalna biblioteka OpenAI działa; zmienia się tylko `base_url`. Przykłady używają `gpt-5.6-sol`; dla pakietu Astra użyj `gpt-astra`.

## Chat Completions

<CodeGroup>
  ```bash cURL theme={null}
  curl https://gpt.teamsoclo.site/v1/chat/completions \
    -H "Authorization: Bearer sk-xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.6-sol",
      "messages": [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain closures in JavaScript"}
      ]
    }'
  ```

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

  client = OpenAI(
      api_key="sk-xxx",
      base_url="https://gpt.teamsoclo.site/v1",
  )

  resp = client.chat.completions.create(
      model="gpt-5.6-sol",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain closures in JavaScript"},
      ],
  )

  print(resp.choices[0].message.content)
  print(resp.usage)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from "openai"

  const client = new OpenAI({
    apiKey: "sk-xxx",
    baseURL: "https://gpt.teamsoclo.site/v1",
  })

  const resp = await client.chat.completions.create({
    model: "gpt-5.6-sol",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain closures in JavaScript" },
    ],
  })

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

<Warning>
  `base_url` musi zawierać `/v1` i **nie** może kończyć się `/`. Biblioteka sama dołącza `/chat/completions`.
</Warning>

Odpowiedzi dokładnie następują schematu OpenAI: `id` to `chatcmpl-...`, `usage` ma `prompt_tokens`, `completion_tokens` i `completion_tokens_details.reasoning_tokens`. Limit jest naliczany dokładnie za `usage.total_tokens`.

## Responses API

Codex i nowsze SDK używają tego protokołu. Ustawienie reasoning jest w `reasoning.effort`.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://gpt.teamsoclo.site/v1/responses \
    -H "Authorization: Bearer sk-xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.6-sol",
      "input": "Write a Python function that checks for primes",
      "reasoning": {"effort": "medium"}
    }'
  ```

  ```python Python theme={null}
  resp = client.responses.create(
      model="gpt-5.6-sol",
      input="Write a Python function that checks for primes",
      reasoning={"effort": "medium"},
  )
  print(resp.output_text)
  ```
</CodeGroup>

## Reasoning effort

Z Chat Completions użyj `reasoning_effort` (`low`, `medium`, `high`). Nieustawiony, brama używa `high`. Dla prostych zadań ustaw `low`, aby zaoszczędzić tokeny:

```python theme={null}
resp = client.chat.completions.create(
    model="gpt-5.6-sol",
    reasoning_effort="low",
    messages=[{"role": "user", "content": "Translate to French: good morning"}],
)
```

<Warning>
  `reasoning_effort` dotyczy tylko Chat Completions. Z Responses API użyj `reasoning: {"effort": ...}`; wysłanie `reasoning_effort` do `/v1/responses` jest odrzucane z "Unsupported parameter".
</Warning>

## Streaming

<CodeGroup>
  ```python Python theme={null}
  stream = client.chat.completions.create(
      model="gpt-5.6-sol",
      messages=[{"role": "user", "content": "Write a short paragraph about autumn"}],
      stream=True,
      stream_options={"include_usage": True},
  )

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

  ```bash cURL theme={null}
  curl https://gpt.teamsoclo.site/v1/chat/completions \
    -H "Authorization: Bearer sk-xxx" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.6-sol",
      "messages": [{"role": "user", "content": "Write a short paragraph about autumn"}],
      "stream": true,
      "stream_options": {"include_usage": true}
    }'
  ```
</CodeGroup>

<Tip>
  Przy trudnych pytaniach model może chwilę myśleć przed pierwszym tokenem. Użyj `stream: true`, aby połączenie nie zostało zerwane. `stream_options.include_usage` sprawia, że ostatni chunk zawiera `usage`, abyś mógł samodzielnie sprawdzić limit.
</Tip>

## Wysyłanie obrazów (vision)

Obrazy są przekazywane w tablicy `content`, jako publiczny URL lub base64 dla lokalnych plików.

<CodeGroup>
  ```python Image URL theme={null}
  resp = client.chat.completions.create(
      model="gpt-5.6-sol",
      messages=[{
          "role": "user",
          "content": [
              {"type": "text", "text": "What error does this show?"},
              {"type": "image_url", "image_url": {"url": "https://example.com/screenshot.png"}},
          ],
      }],
  )
  print(resp.choices[0].message.content)
  ```

  ```python Local file (base64) theme={null}
  import base64

  with open("screenshot.png", "rb") as f:
      b64 = base64.b64encode(f.read()).decode()

  resp = client.chat.completions.create(
      model="gpt-5.6-sol",
      messages=[{
          "role": "user",
          "content": [
              {"type": "text", "text": "What error does this show?"},
              {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
          ],
      }],
  )
  print(resp.choices[0].message.content)
  ```
</CodeGroup>

<Warning>
  Obrazy kosztują tokeny w zależności od rozmiaru. Przycinaj do istotnej części zamiast wysyłać pełny zrzut ekranu 4K.
</Warning>

## Modele i limit przez API

```bash theme={null}
# Modele, które może wywołać ten klucz
curl https://gpt.teamsoclo.site/v1/models -H "Authorization: Bearer sk-xxx"

# Limit (starsze punkty końcowe OpenAI)
curl https://gpt.teamsoclo.site/v1/dashboard/billing/subscription -H "Authorization: Bearer sk-xxx"
curl https://gpt.teamsoclo.site/v1/dashboard/billing/usage -H "Authorization: Bearer sk-xxx"
```

`subscription` zwraca sumę w `hard_limit_usd`; `usage` zwraca zużyte w `total_usage`, w **centach** (podziel przez 100 przed porównaniem). [Strona sprawdzania](https://gpt.teamsoclo.site/check) robi to za ciebie.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.