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

# Quickstart

> Make your first request to Pearl Inference in a few minutes.

**1. Create an account**

[Sign up](https://platform.pearlresearch.ai/sign-up) and create your organization, it takes a minute. New organizations receive a \$1 welcome credit, so you can make your first requests before [adding credits](https://platform.pearlresearch.ai/billing). The welcome credit is a promotion that may change or be discontinued at any time.

**2. Create an API key**

Go to the [API Keys](https://platform.pearlresearch.ai/api-keys) page in the dashboard and select **Create key**. Keys start with `sk-prl-infapi-` and are shown only once, so store yours somewhere safe. Then export it as an environment variable in your terminal:

```bash macOS / Linux theme={null}
export PEARL_API_KEY="sk-prl-infapi-your_api_key"
```

```powershell Windows (PowerShell) theme={null}
$env:PEARL_API_KEY="sk-prl-infapi-your_api_key"
```

**3. Install an SDK**

Pearl Inference is OpenAI-compatible, so you can use the official OpenAI SDKs, or skip the SDK and call the REST API directly from any language.

```bash Python theme={null}
pip install openai
```

```bash TypeScript theme={null}
npm install openai
```

**4. Run your first request**

Point the client at the Pearl base URL `https://inference.pearlresearch.ai/v1` and send a chat completion to [any supported model](/docs/models.md). Organizations on the EU [inference region](/docs/concepts.md#regions) call their own base URL instead, shown on the Settings page:

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

client = OpenAI(
    base_url="https://inference.pearlresearch.ai/v1",
    api_key=os.environ.get("PEARL_API_KEY"),
)

response = client.chat.completions.create(
    model="zai-org/GLM-5.3",
    messages=[{"role": "user", "content": "What are the top 3 things to do in New York?"}],
)

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

```typescript TypeScript theme={null}
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://inference.pearlresearch.ai/v1',
  apiKey: process.env.PEARL_API_KEY,
});

const response = await client.chat.completions.create({
  model: 'zai-org/GLM-5.3',
  messages: [{role: 'user', content: 'What are the top 3 things to do in New York?'}],
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={null}
curl https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3",
    "messages": [{"role": "user", "content": "What are the top 3 things to do in New York?"}]
  }'
```

> [!TIP]
>
> Prefer no code? The [playground](https://platform.pearlresearch.ai/playground) runs the same models in your browser, and every request, playground or SDK, shows up in your dashboard's Analytics tab.

## Going further

The same client can stream tokens, call tools, return strict JSON, reason step by step, and read images. Try these variations:

### Stream the response

Set `stream=True` to receive the response token by token as it's generated instead of waiting for the full reply:

```python Python theme={null}
stream = client.chat.completions.create(
    model="zai-org/GLM-5.3",
    messages=[{"role": "user", "content": "Tell me a short story"}],
    stream=True,
)

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

```typescript TypeScript theme={null}
const stream = await client.chat.completions.create({
  model: 'zai-org/GLM-5.3',
  messages: [{role: 'user', content: 'Tell me a short story'}],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
```

```bash cURL theme={null}
curl -N https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3",
    "messages": [{"role": "user", "content": "Tell me a short story"}],
    "stream": true
  }'
```

[Learn more about streaming →](/docs/streaming.md)

### Call a reasoning model

GLM-5.3 (the model from your first request above) and the DeepSeek V4 models work through a problem before answering. The thinking arrives in a separate `reasoning` field on the message, and the final answer in `content`, when streaming, read both fields off each chunk's delta:

```python Python theme={null}
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro-0813",
    messages=[{"role": "user", "content": "What is 25 * 37? Show your work."}],
)

msg = response.choices[0].message

# Reasoning models return their thinking in a separate reasoning field.
reasoning = getattr(msg, "reasoning", None)
if reasoning is None and hasattr(msg, "model_extra"):
    reasoning = (msg.model_extra or {}).get("reasoning")

if reasoning:
    print("Reasoning:", reasoning)
print("Answer:", msg.content)
```

```typescript TypeScript theme={null}
const response = await client.chat.completions.create({
  model: 'deepseek-ai/DeepSeek-V4-Pro-0813',
  messages: [{role: 'user', content: 'What is 25 * 37? Show your work.'}],
});

// Reasoning models return their thinking in a separate reasoning field.
const msg = response.choices[0].message as {content: string | null; reasoning?: string};

if (msg.reasoning) {
  console.log('Reasoning:', msg.reasoning);
}
console.log('Answer:', msg.content);
```

```bash cURL theme={null}
curl https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V4-Pro-0813",
    "messages": [{"role": "user", "content": "What is 25 * 37? Show your work."}]
  }'
```

[Learn more about reasoning models →](/docs/reasoning.md)

### Use tools (function calling)

Every model in the catalog supports tool definitions, so the model can ask your code to run a function and use its result:

```python Python theme={null}
response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro-0813",
    messages=[{"role": "user", "content": "What's the weather in Paris?"}],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "Get the current weather for a location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "City name, e.g. Paris",
                        }
                    },
                    "required": ["location"],
                },
            },
        }
    ],
)

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

```typescript TypeScript theme={null}
const response = await client.chat.completions.create({
  model: 'deepseek-ai/DeepSeek-V4-Pro-0813',
  messages: [{role: 'user', content: "What's the weather in Paris?"}],
  tools: [
    {
      type: 'function',
      function: {
        name: 'get_weather',
        description: 'Get the current weather for a location',
        parameters: {
          type: 'object',
          properties: {
            location: {type: 'string', description: 'City name, e.g. Paris'},
          },
          required: ['location'],
        },
      },
    },
  ],
});

console.log(response.choices[0].message.tool_calls);
```

```bash cURL theme={null}
curl https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V4-Pro-0813",
    "messages": [{"role": "user", "content": "What is the weather in Paris?"}],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get the current weather for a location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {"type": "string", "description": "City name, e.g. Paris"}
            },
            "required": ["location"]
          }
        }
      }
    ]
  }'
```

[Learn more about function calling →](/docs/function-calling.md)

### Get structured JSON

Set `response_format` to JSON mode and describe the shape you want in the system prompt to get parseable JSON back:

```python Python theme={null}
response = client.chat.completions.create(
    model="zai-org/GLM-5.3",
    messages=[
        {
            "role": "system",
            "content": "Extract the person as JSON with exactly two keys: name (string) and age (number).",
        },
        {"role": "user", "content": "John is 30 years old."},
    ],
    response_format={"type": "json_object"},
)

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

```typescript TypeScript theme={null}
const response = await client.chat.completions.create({
  model: 'zai-org/GLM-5.3',
  messages: [
    {
      role: 'system',
      content: 'Extract the person as JSON with exactly two keys: name (string) and age (number).',
    },
    {role: 'user', content: 'John is 30 years old.'},
  ],
  response_format: {type: 'json_object'},
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={null}
curl https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3",
    "messages": [
      {"role": "system", "content": "Extract the person as JSON with exactly two keys: name (string) and age (number)."},
      {"role": "user", "content": "John is 30 years old."}
    ],
    "response_format": {"type": "json_object"}
  }'
```

[Learn more about structured outputs →](/docs/json-mode.md)

### Analyze an image

GLM-5.3 Flash accepts images. Add an `image_url` block to the user message to ask questions about a picture:

```python Python theme={null}
import base64

# The endpoint accepts base64 data URIs, not remote URLs.
# Encode your image before sending it.
with open("yosemite.png", "rb") as f:
    data_uri = f"data:image/png;base64,{base64.b64encode(f.read()).decode()}"

response = client.chat.completions.create(
    model="zai-org/GLM-5.3-Flash",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this image in one sentence."},
                {"type": "image_url", "image_url": {"url": data_uri}},
            ],
        }
    ],
)

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

```typescript TypeScript theme={null}
import fs from 'node:fs';

// The endpoint accepts base64 data URIs, not remote URLs.
// Encode your image before sending it.
const image = fs.readFileSync('yosemite.png');
const dataUri = `data:image/png;base64,${image.toString('base64')}`;

const response = await client.chat.completions.create({
  model: 'zai-org/GLM-5.3-Flash',
  messages: [
    {
      role: 'user',
      content: [
        {type: 'text', text: 'Describe this image in one sentence.'},
        {type: 'image_url', image_url: {url: dataUri}},
      ],
    },
  ],
});

console.log(response.choices[0].message.content);
```

```bash cURL theme={null}
# Encode your image as a base64 data URI first.
DATA_URI="data:image/png;base64,$(base64 < yosemite.png | tr -d '\n')"

curl https://inference.pearlresearch.ai/v1/chat/completions \
  -H "Authorization: Bearer $PEARL_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"model\": \"zai-org/GLM-5.3-Flash\",
    \"messages\": [
      {
        \"role\": \"user\",
        \"content\": [
          {\"type\": \"text\", \"text\": \"Describe this image in one sentence.\"},
          {\"type\": \"image_url\", \"image_url\": {\"url\": \"$DATA_URI\"}}
        ]
      }
    ]
  }"
```

> [!NOTE]
>
> The `image_url.url` field follows the OpenAI schema, but the endpoint does not fetch remote URLs, encode your image as a `data:image/<format>;base64,…` data URI first. (A remote URL is silently unresolvable at the inference engine and returns an upstream validation error.)

[Learn more about vision →](/docs/vision.md)

## Next steps

> [card] [Models](/docs/models.md)
>
> Compare the catalog and pick the right model for your workload.

> [card] [Concepts](/docs/concepts.md)
>
> How organizations, API keys, credits, and billing fit together.

> [card] [Playground](https://platform.pearlresearch.ai/playground)
>
> Prototype prompts against every model in the browser.


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