Create an API key.
Generate a token in the console, then keep it in an environment variable. Never expose a secret key in browser code or commit it to source control.
Create API key ↗︎JUSTAPI_API_KEY=sk-••••••••Choose a chat format.
JustAPI supports three chat formats used by common SDK integrations. A model’s detail panel shows which formats it accepts.
POST /chat/completions- Authentication
Authorization: Bearer <KEY>- System instruction
- A
systemitem insidemessages - Message roles
system,user,assistant,tool- Response text
choices[0].message.content
{
"model": "gpt-5.4-mini",
"messages": [
{ "role": "system", "content": "Be concise." },
{ "role": "user", "content": "Hello" }
]
}POST /responses- Authentication
Authorization: Bearer <KEY>- System instruction
- Top-level
instructionsfield - Input
- A string or an array of message and content items
- Conversation state
- Continue with
previous_response_id - Response text
- SDK convenience property
output_text
{
"model": "gpt-5.4-mini",
"instructions": "Be concise.",
"input": "Hello"
}POST /messages- Authentication
x-api-key: <KEY>andanthropic-version- System instruction
- Top-level
systemfield - Message roles
userandassistant- Response text
content[0].text
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"system": "Be concise.",
"messages": [
{ "role": "user", "content": "Hello" }
]
}Chat Completions offers the broadest model compatibility. Check Models for per-model endpoint support.
Responses API provides unified input and built-in conversation state. Check Models for per-model endpoint support.
Anthropic Messages lets an existing Anthropic SDK integration keep its familiar request shape. Check Models for per-model endpoint support.
Send your first request.
This example uses OpenAI Chat Completions. Set https://api.justapi.ai/v1 as the base URL and choose a compatible model ID from the live catalogue.
Read the response.
The response shape follows the protocol selected above. Every format includes usage information for token accounting.
response.choices[0].message.contentresponse.output_textmessage.content[0].textChoose what to ship.
Compare input and output rates, inspect tiered pricing, or connect an agent to the token-efficient JustAPI remote MCP server.