Skip to Content
Getting startedQuickstart

Quickstart

Get a completion back from PlainField in under five minutes. You will create an account, generate an API key, and send your first request.

Prerequisites

1. Create your account

Go to app.plainfield-ai.com/signup  and sign up with your email. After confirming your email, you are asked to create an organization — this is the workspace that owns your API keys, usage, and billing.

2. Create an API key

In the dashboard, open Keys → API Keys and select Create key. Give it a name (for example, production) and select Generate.

Your key is shown once, in the form pt_live_.... Copy it now and store it somewhere safe — you cannot view it again. If you lose it, revoke it and create a new one.

3. Send a request

Send an OpenAI-format request to the gateway. The provider is selected by the provider/model prefix in the model field, and your API key goes in the Authorization header.

curl -X POST https://api.plainfield-ai.com/ai/chat/completions \ -H 'Authorization: Bearer pt_live_...' \ -H 'Content-Type: application/json' \ -d '{ "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "Say hello in one sentence."}] }'

Expected output

An OpenAI-format chat completion:

{ "id": "chatcmpl-...", "object": "chat.completion", "model": "gpt-4o-mini", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help you today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 12, "completion_tokens": 9, "total_tokens": 21 } }

PlainField logged this request and estimated its cost from the usage token counts. Open Analytics in the dashboard to see it appear.

Common errors

SymptomCauseFix
401 UnauthorizedMissing or invalid API keySend Authorization: Bearer pt_live_... with a key from Keys → API Keys.
401 after a whileKey was revoked or expiredCreate a new key in the dashboard.
400 unknown modelUnsupported provider/model stringUse a supported model. See Providers and models.

Next steps

Last updated on