Get Started

Quickstart

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

1

Create an account

Sign up and create your organization, it takes a minute. New organizations receive a $5 welcome credit, so you can make your first requests before adding credits.

2

Create an API key

Go to the 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:

export 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.

pip 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:

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.2",
    messages=[{"role": "user", "content": "What are the top 3 things to do in New York?"}],
)

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

Prefer no code? The 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:

stream = client.chat.completions.create(
    model="zai-org/GLM-5.2",
    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)

Learn more about streaming

Call a reasoning model

GLM-5.2 (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:

response = client.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    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)

Learn more about reasoning models

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:

response = client.chat.completions.create(
    model="deepseek/deepseek-v4-flash-0731",
    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)

Learn more about function calling

Get structured JSON

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

response = client.chat.completions.create(
    model="zai-org/GLM-5.2",
    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)

Learn more about structured outputs

Analyze an image

Gemma 4 31B Instruct accepts images. Add an image_url block to the user message to ask questions about a picture:

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="google/gemma-4-31b-it",
    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)

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

Next steps

Quickstart, Pearl Inference Docs