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

# Prime Inference

> Run models through an OpenAI-compatible API

Prime Inference provides one OpenAI-compatible API for both hosted and gateway models. Check the [model catalog](https://app.primeintellect.ai/dashboard/inference?tab=models) for current availability, serving type, and pricing; they vary by model.

## Hosted and gateway models

| Serving type | How the request is served |
| - | - |
| **Hosted** | Prime Intellect runs the model on its own inference infrastructure. `z-ai/glm-5.3` is a hosted model. |
| **Gateway** | Prime Intellect routes the request to an external inference provider. The model is not served on Prime Intellect infrastructure. |

Both use the same Prime API key and endpoint, and you select a model by its catalog ID. Pricing, limits, and supported features are set per model and shown in the catalog, so check them before choosing a model, especially if where a model runs matters for your workload.

## Get started

1. Create an API key with the **Inference** permission in the [API keys guide](/api-reference/api-keys).
2. Set `PRIME_API_KEY` in your environment. Keep it on the server, not in browser code or a public repository.
3. Send a chat completion with a model ID from the catalog. The example below uses [GLM-5.3](/inference/models/glm-5-3).

```bash theme={null}
export PRIME_API_KEY="your-api-key"

curl https://api.pinference.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $PRIME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "z-ai/glm-5.3",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

### OpenAI Python SDK

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

client = OpenAI(
    api_key=os.environ["PRIME_API_KEY"],
    base_url="https://api.pinference.ai/api/v1",
)
response = client.chat.completions.create(
    model="z-ai/glm-5.3",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
```

To list model IDs programmatically, call `GET https://api.pinference.ai/api/v1/models` or run `prime inference models`. Use the returned model ID exactly as shown. See the [Models API](/api-reference/inference-models) and [Chat Completions API](/api-reference/inference-chat-completions) for endpoint details.

## Team billing

Requests bill the API key owner's personal account unless you include `X-Prime-Team-ID`. To use team credits, obtain your team ID from the [team profile](https://app.primeintellect.ai/dashboard/team-profile) or `prime teams list`, and add the header to **each** direct API request:

```bash theme={null}
-H "X-Prime-Team-ID: your-team-id"
```

With the OpenAI SDK, set `default_headers={"X-Prime-Team-ID": "your-team-id"}` on the client. `prime config set-team-id` applies to CLI operations, not to direct HTTP or SDK requests. Check usage and balances in the [billing dashboard](https://app.primeintellect.ai/dashboard/billing). If a request returns `insufficient_funds`, check the balance of the account selected by the key and optional team header.

## Next steps

* [GLM-5.3](/inference/models/glm-5-3): use a model hosted on Prime Inference.
* [LoRA adapter deployments](/inference/adapter-deployments): serve adapters from Hosted Training runs.
* [Troubleshooting](/inference/troubleshooting): resolve billing errors.
* [Evaluate models](/tutorials-environments/evaluating) with Prime Lab.


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