> For the complete documentation index, see [llms.txt](https://docs.nvcl.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nvcl.ai/get-started/first-request.md).

# First request

Send requests to the server from [Start the server](/get-started/run.md). To try the model before writing code, press `c` on its page in the menu for a chat in the terminal ([A model's page](/get-started/install.md#a-models-page)). When the model is up, `nvcl-ai` prints the base URL, the model name and, for a server started with `--public`, the API key, with ready `curl` commands. In the menu, the model's API endpoint screen (`e`) shows them with a Python example: `u` copies the URL, `k` the `curl` command and `p` the Python example, also over SSH in most terminals. `o` restarts the model open to the network, or back to this machine only, after you confirm (see [Open to the network](/get-started/run.md#open-to-the-network)).

<figure><img src="https://3133985975-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDZCnCH3aMU9wYLt2Z4wR%2Fuploads%2Fgit-blob-485b36f8802eac526ad71953705abc48029d46ba%2Fnvcl-10-api-endpoint.png?alt=media" alt="The API endpoint screen of the nvcl-ai menu: base URL http://127.0.0.1:8000/v1, model qwen3.8-27b, format standard, API key not needed (this machine only), a curl example and a Python example with the openai package; u, k and p copy the URL, the curl command and the Python example, and o turns the network on or off"><figcaption><p>The API endpoint screen in the <code>nvcl-ai</code> menu.</p></figcaption></figure>

The examples use `http://127.0.0.1:8000` and the model name `qwen3.8-27b`. On a server started with `--public`, use the address `nvcl-ai` printed, and the key:

```bash
export API_KEY=$(cat ~/.nvcl-ai/api-key)
```

Without `--public` no key is needed, and the `Authorization` header can go.

## Check the server

```bash
curl -s http://127.0.0.1:8000/health          # "ok" once the model is loaded
curl -s http://127.0.0.1:8000/v1/models -H "Authorization: Bearer $API_KEY"   # the model, its max_model_len and tier
```

## Chat

```bash
curl -s http://127.0.0.1:8000/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" -H 'Content-Type: application/json' -d '{
  "model": "qwen3.8-27b",
  "messages": [{"role": "user", "content": "Write a Python function that checks whether a string is a palindrome."}],
  "max_tokens": 2048
}'
```

The answer is in `choices[0].message.content`, the reasoning in `choices[0].message.reasoning_content`, and token counts in `usage`. `"stream": true` streams the answer.

## OpenAI Python SDK

```python
import os
from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8000/v1", api_key=os.environ.get("API_KEY", "none"))

reply = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "Summarize what a KV cache is."}],
    max_tokens=1024,
)
print(reply.choices[0].message.content)

# Streaming
for chunk in client.chat.completions.create(
    model="qwen3.8-27b", stream=True,
    messages=[{"role": "user", "content": "Count to five."}],
):
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
```

## Tool calls

`nvcl-ai` starts Qwen3.8-27B with its tool-call parser, so tool calls come back as `tool_calls`, as with OpenAI.

```python
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Current weather in a city",
        "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
    },
}]
reply = client.chat.completions.create(
    model="qwen3.8-27b",
    messages=[{"role": "user", "content": "What is the weather in Lisbon?"}],
    tools=tools,
)
call = reply.choices[0].message.tool_calls[0]
print(call.function.name, call.function.arguments)   # finish_reason is "tool_calls"
```

Send the result back as a `tool` message with the call's `tool_call_id`.

## Reasoning on and off

Thinking is on by default. Per request:

```python
# Off
client.chat.completions.create(model="qwen3.8-27b", messages=msgs,
    extra_body={"chat_template_kwargs": {"enable_thinking": False}})

# On, with a lower effort
client.chat.completions.create(model="qwen3.8-27b", messages=msgs, reasoning_effort="low")
```

The effort values differ by model: see [Per model](/reference/api.md#per-model).

## Responses and Anthropic Messages APIs

Clients built for the OpenAI Responses API or the Anthropic Messages API connect to the same server: `POST /v1/responses` and `POST /v1/messages`, with the same key. See [Endpoints](/reference/api.md#endpoints).

Next: every endpoint and parameter in [OpenAI-compatible API](/reference/api.md).
