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

# Quickstart

> Send your first request to a Prism model with an OpenAI-compatible client.

Prism accepts OpenAI Chat Completions requests at
`https://api.prisminference.com/v1`. You need a Prism API key and a
[public model ID](/models).

## Send your first request

<Steps>
  <Step title="Set your API key">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    export PRISM_API_KEY="YOUR_PRISM_API_KEY"
    ```

    Store the key in your server-side secret manager. Do not commit it or expose it
    to browser code.
  </Step>

  <Step title="Call a model">
    <CodeGroup>
      ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
      curl --fail-with-body "https://api.prisminference.com/v1/chat/completions" \
        -H "Authorization: Bearer $PRISM_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "prism-glm53",
          "messages": [
            {
              "role": "user",
              "content": "Write a TypeScript function that limits concurrent promises."
            }
          ]
        }'
      ```

      ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
      import OpenAI from "openai";

      const client = new OpenAI({
        apiKey: process.env.PRISM_API_KEY,
        baseURL: "https://api.prisminference.com/v1",
      });

      const response = await client.chat.completions.create({
        model: "prism-glm53",
        messages: [
          {
            role: "user",
            content: "Write a TypeScript function that limits concurrent promises.",
          },
        ],
      });

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

      ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
      import os
      from openai import OpenAI

      client = OpenAI(
          api_key=os.environ["PRISM_API_KEY"],
          base_url="https://api.prisminference.com/v1",
      )

      response = client.chat.completions.create(
          model="prism-glm53",
          messages=[
              {
                  "role": "user",
                  "content": "Write a TypeScript function that limits concurrent promises.",
              }
          ],
      )

      print(response.choices[0].message.content)
      ```
    </CodeGroup>

    Install the OpenAI client with `npm install openai` or `pip install openai`.
  </Step>

  <Step title="Read the completion">
    The endpoint returns a standard Chat Completions response:

    ```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
    {
      "id": "chatcmpl_01J...",
      "object": "chat.completion",
      "created": 1788926400,
      "model": "prism-glm53",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "Here is a concurrency limiter..."
          },
          "finish_reason": "stop"
        }
      ],
      "usage": {
        "prompt_tokens": 18,
        "completion_tokens": 142,
        "total_tokens": 160
      }
    }
    ```

    Assistant text is in `choices[0].message.content`. Token counts are in `usage`.
  </Step>
</Steps>

## Stream tokens

Pass `stream: true` to receive incremental Chat Completions chunks:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const stream = await client.chat.completions.create({
  model: "prism-glm53",
  messages: [{ role: "user", content: "Explain optimistic locking." }],
  stream: true,
});

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

## Use the Anthropic format

Prism also accepts Anthropic Messages requests. Point an Anthropic client at
`https://api.prisminference.com` without the `/v1` suffix:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.PRISM_API_KEY,
  baseURL: "https://api.prisminference.com",
});

const message = await client.messages.create({
  model: "prism-glm53",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Write a tiny rate limiter in TypeScript." }],
});
```

## Next steps

<CardGroup cols={2}>
  <Card title="Choose a model" icon="cpu" href="/models">
    Compare the public model IDs and context windows.
  </Card>

  <Card title="Stream responses" icon="radio" href="/guides/streaming">
    Handle chunks, usage, disconnects, and retries.
  </Card>

  <Card title="Call tools" icon="wrench" href="/guides/tool-calling">
    Run the OpenAI or Anthropic tool-use loop.
  </Card>

  <Card title="Return JSON" icon="braces" href="/guides/structured-outputs">
    Constrain model output to valid JSON or a schema.
  </Card>
</CardGroup>
