Skip to main content

Quickstart

1

Create an API key

Sign in to the developer console, open API keys, and create a key. New keys begin with sk-prism- and are revealed only once.
2

Set environment variables

3

Check credits and select a trial chat model

Signup does not by itself guarantee welcome credit. balance_minor is an aggregate across credit kinds, so /v1/models is the authoritative admission check. On 402, the example follows the typed error.action; authentication, policy, rate-limit, and server failures are surfaced unchanged. The command also intersects the public trial policy with the authenticated catalog, so it cannot select a hidden or policy-denied model. Paid and organization accounts should use a chat model approved by their administrator instead of relying on catalog list position.
4

Create a chat completion

The response uses the OpenAI chat-completion shape. For non-streaming chat responses, Prism may also return:
  • x-prism-trace-id: request ID for a later usage lookup
  • x-prism-cost-credits: charged amount in minor credits
  • x-prism-cache: HIT or MISS when response caching applies
Never expose a Prism API key in browser code, a mobile application, a public repository, logs, or screenshots. Call Prism from your server.
อ่านภาษาไทย