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
- A web browser, to sign up at app.plainfield-ai.com
curl(or any HTTP client)
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
| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized | Missing or invalid API key | Send Authorization: Bearer pt_live_... with a key from Keys → API Keys. |
401 after a while | Key was revoked or expired | Create a new key in the dashboard. |
400 unknown model | Unsupported provider/model string | Use a supported model. See Providers and models. |
Next steps
- Use the OpenAI SDK instead of
curl: Your first request with the OpenAI SDK - Attribute spend to prompts and users: Track prompt costs
- Compare models without code: Workbench
- See every endpoint: API reference