Skip to main content
Pioneer implements the Anthropic Messages API so you can route existing Anthropic SDK code to your fine-tuned Pioneer models. Set base_url to https://api.pioneer.ai/v1, authenticate with your Pioneer API key, and use your training job ID as the model name. No other code changes are required.

Endpoints

MethodPathDescription
POST/v1/messagesCreate a message (Anthropic-compatible)

Configure the Anthropic SDK

Pass your Pioneer API key and base URL when constructing the client:
import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.pioneer.ai/v1"
)

Create a message

POST /v1/messages accepts the same request shape as the Anthropic Messages API. Set model to your training job ID and include your messages array. You can pass Pioneer-specific fields like schema alongside the standard Anthropic fields.

Request parameters

model
string
required
Training job ID (e.g. job_abc123) or a base model ID. This is the model that processes your request.
max_tokens
number
required
Maximum number of tokens to generate in the response.
messages
object[]
required
Conversation messages. Each object has a role ("user" or "assistant") and a content string.
schema
object
Pioneer-specific extraction schema. Define entities, classifications, structures, or relations to control what the model extracts. See Pioneer inference for full schema documentation.

Examples

import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.pioneer.ai/v1"
)

message = client.messages.create(
    model="YOUR_TRAINING_JOB_ID",
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": "Extract entities from: Apple launched the iPhone."
        }
    ]
)

print(message.content[0].text)

Streaming

The /v1/messages endpoint supports streaming. Set stream=True in the SDK or "stream": true in the raw request body.
import anthropic

client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://api.pioneer.ai/v1"
)

with client.messages.stream(
    model="YOUR_TRAINING_JOB_ID",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Summarize the following: ..."}]
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)