API Reference
Chat Completions
POST https://api.platform.preferredai.jp/v1/chat/completions
This endpoint generates responses from generation AI models based on provided chat messages.
Currently, only the PLaMo Prime model is supported.
| Model ID | Context Length | Maximum Output Tokens | Reasoning Capability |
|---|---|---|---|
plamo-3.0-prime | 262,144 tokens | 20,480 tokens | Yes |
plamo-3.1-prime | 262,144 tokens | 20,480 tokens | Yes |
Sample Usage
For curl, set your PLaMo API key in an environment variable named PLAMO_API_KEY, and for Python libraries, set it in an environment variable named OPENAI_API_KEY.
Request
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"messages": [
{
"role": "system",
"content": "You are a travel advisor."
},
{
"role": "user",
"content": "Please recommend an optimal sightseeing route in Kanazawa from morning until evening."
}
],
"model": "plamo-3.0-prime"
}
EOFimport os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.platform.preferredai.jp/v1",
model="plamo-3.0-prime",
streaming=True,
# other parameters...,
)
messages=[
{"role": "system", "content": "You are a travel advisor."},
{"role": "user", "content": "Please recommend an optimal sightseeing route in Kanazawa from morning until evening."},
]
for chunk in llm.stream(messages):
print(chunk.content, end="", flush=True)import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.platform.preferredai.jp/v1",
# other parameters...,
)
completion = client.chat.completions.create(
model="plamo-3.0-prime",
messages=[
{"role": "system", "content": "You are a travel advisor."},
{"role": "user", "content": "Please recommend an optimal sightseeing route in Kanazawa from morning until evening."},
],
stream=True,
)
for chunk in completion:
if chunk.choices and chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="", flush=True)Response
{
"id": "chat-eb6da3a371c546c8a8c4629794328c5b",
"object": "chat.completion",
"created": 1733220118,
"model": "plamo-3.0-prime",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The quadratic formula for solving second-degree equations is as follows:...",
"tool_calls": []
},
"logprobs": null,
"finish_reason": "stop",
"stop_reason": null
}
],
"usage": {
"prompt_tokens": 169,
"total_tokens": 394,
"completion_tokens": 225
},
"prompt_logprobs": null
}data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[{"index":0,"delta":{"role":"assistant"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":143,"total_tokens":143,"completion_tokens":0}}
data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[{"index":0,"delta":{"content":"PL"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":143,"total_tokens":144,"completion_tokens":1}}
data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[{"index":0,"delta":{"content":"a"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":143,"total_tokens":145,"completion_tokens":2}}
data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[{"index":0,"delta":{"content":"Mo"},"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":143,"total_tokens":146,"completion_tokens":3}}
data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[{"index":0,"delta":{"content":""},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":143,"total_tokens":148,"completion_tokens":5}}
data: {"id":"chat-e05656fa4721494a93d54410881f00c8","object":"chat.completion.chunk","created":1734345308,"model":"plamo-3.0-prime","choices":[],"usage":{"prompt_tokens":143,"total_tokens":148,"completion_tokens":5}}
data: [DONE]For the /chat/completions endpoint, models supporting reasoning capabilities support both reasoning and reasoning_content. Non-streaming responses include reasoning and reasoning_content within each choice.message, while streaming responses (when stream: true) incrementally include reasoning and reasoning_content in each chunk's choice.delta.
Request Parameters
Please include the following parameters in the request body in JSON format.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| model | string | required | Specifies the ID of the model to use. | |
| messages | array of MessageObject | required | Sets the list of chat messages. Each message must include a role and content. | |
| frequency_penalty | float | optional | 0.0 | Controls the frequency of token repetition. Valid values range from -2.0 to 2.0. |
| max_tokens | integer or null | optional | 20480 | Stops generation once the specified number of tokens have been produced. Depending on the resulting content, generation may terminate earlier. Cannot be set to exceed the model's maximum output token limit. |
| n | integer | optional | 1 | Specifies the number of times to generate content in a single request. Valid values are 1 or 2. |
| presence_penalty | float | optional | 0.0 | Applies a penalty for tokens that have already appeared in the output. Valid values range from -2.0 to 2.0. |
| reasoning | ReasoningObject | optional | null | Allows configuration of reasoning-related settings. |
| reasoning_effort | none or medium | optional | none | Specifies the level of reasoning to perform. Only none (no reasoning) or medium (standard amount of reasoning) are supported. If effort is specified in reasoning, this setting will be ignored. |
| response_format | ResponseFormatObject or null | optional | null | Specifies the response output format. Set { "type": "json_schema", "json_schema": {...} } to generate a JSON response that follows the supplied JSON Schema. |
| seed | integer or null | optional | null | Specifies the random seed for token generation. Depending on internal state, different results may occur even when using the same seed value. |
| safety_identifier | string or null | optional | null | An identifier for user identification. This may be used by the PLaMo API side to detect anomalies or other issues. Since it may be persisted on the server, do not include any personal information or sensitive data. |
| stop | array of strings, strings, or null | optional | null | Stops generation when any of the specified words are encountered. |
| stream | boolean | optional | false | Set to 'true' when using streaming responses. |
| stream_options | StreamOptionObject or null | optional | null | Specify options when enabling streaming. See StreamOptionObject below for details. |
| temperature | float | optional | 0.3 | Specifies the sampling temperature. Valid values range from 0 to 2.0. |
| tools | array of ChatCompletionToolsObject | optional | null | Defines the functions to be used for Function Calling. |
| tool_choice | ChatCompletionToolChoiceObject or "none" or "auto" or "required" | optional | null | Specifies the function to be invoked. |
| top_p | float | optional | 1.0 | Controls how far into the token generation results to consider. Valid values range from 0 to 1.0. |
web_search_options | WebSearchOptionsObject or null | optional | null | Searches the web and answers with citations based on the search results. See Web Search for details. |
Response (when not using streaming)
| Field | Type | Description |
|---|---|---|
| id | string | A unique ID assigned for each message. |
| choices | array of ChoiceObject | Returns chat-style generation results. |
| created | integer | Returns the generated UNIX timestamp. |
| model | string | Returns the model ID. |
| object | string | Always returns 'chat.completion'. |
| usage | UsageObject | Returns an object containing usage statistics. |
| plamo_usage_details | array of PlamoUsageDetailObject or null | PLaMo's usage details breakdown (web search counts, tokens, etc.). |
Response Format (When Streaming is Used)
The response is returned using server-sent events. The response will conclude with an event: [DONE].
| Field | Type | Description |
|---|---|---|
| id | string | A unique ID assigned for each message. |
| choices | array of StreamChoiceObject | Returns chat-style generation results. |
| created | integer | Unix timestamp of when the generation was completed. |
| model | string | Returns the model ID. |
| object | string | Always returns 'chat.completion.chunk'. |
| usage | UsageObject or null | Returns an object containing usage statistics. |
| plamo_usage_details | array of PlamoUsageDetailObject or null | PLaMo's usage details breakdown. Included in the final usage chunk. |
Important Note about max_tokens
Currently, the API will output an error when the sum of input tokens + max_tokens exceeds the model's context length. Even if the actual generated output contains fewer tokens than the context length when rendered, the API will still produce an error during the input phase.
Specifically, if max_tokens is not explicitly set, it defaults to 20480, which means an error will occur even if the input length is below the context limit. In such cases, please explicitly specify max_tokens to ensure that input tokens + max_tokens does not exceed the model's context length.
Web Search
When web_search_options is specified, the model searches the web as needed and answers with citations based on the search results. The supported model is plamo-3.1-prime.
Request
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/chat/completions" \
-d @- << EOF
{
"model": "plamo-3.1-prime",
"messages": [
{"role": "user", "content": "Where is the head office of Preferred Networks?"}
],
"web_search_options": {
"search_context_size": "low",
"user_location": {
"type": "approximate",
"approximate": {"country": "JP", "city": "Tokyo", "timezone": "Asia/Tokyo"}
}
}
}
EOFResponse
{
"id": "chatcmpl-621c7cbd-a821-48b1-90b9-70c142934562",
"object": "chat.completion",
"model": "plamo-3.1-prime",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The head office of Preferred Networks is in Otemachi Building, 1-6-1 Otemachi, Chiyoda-ku, Tokyo. ([preferred.jp](https://www.preferred.jp/en/company))",
"annotations": [
{
"type": "url_citation",
"url_citation": {
"url": "https://www.preferred.jp/ja/company",
"title": "Company - Preferred Networks, Inc.",
"start_index": 52,
"end_index": 93
}
}
],
"tool_calls": []
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20796,
"completion_tokens": 383,
"total_tokens": 21179
},
"plamo_usage_details": [
{"model": "plamo-3.1-prime", "usage_type": "main_response", "input_tokens": 20796, "output_tokens": 383, "token_consumed": 21179},
{"model": "web_search_basic", "usage_type": "web_search", "input_tokens": 1, "output_tokens": 0, "token_consumed": 1}
]
}- The answer text carries a source link in the form
([domain](URL))after each passage quoted from a page. message.annotationslists the sources the answer cites asurl_citation.start_index/end_indexpoint to the cited span in the text; a citation of search results points to a zero-width position at the end of the sentence.- The number of searches is the
token_consumedof theplamo_usage_detailsentry whoseusage_typeisweb_search. Charges are based on the number of tokens and the number of searches. reasoning_effortandreasoning(includingsummary) can be specified. Withstream, the answer arrives after the search.- When
response_formatspecifies a JSON Schema, the answer follows that format and carries no citations. - When the output limit is reached,
finish_reasonislength. - The following parameters cannot be specified (a 400 error is returned):
temperature,top_p,presence_penalty,frequency_penalty,n,seed,stop,logprobs,tools,tool_choice. - Web search cannot be used with messages that contain images.
Deep Research API
POST https://api.platform.preferredai.jp/v1/responses
Searches the web repeatedly on a question and writes a report with citations. It runs as an asynchronous job in the same shape as the OpenAI Responses API with background: true: creating it immediately returns a Response object with status: "queued". Generation takes several minutes to tens of minutes, so retrieve the result with the returned id.
| Model ID | Description |
|---|---|
plamo-3.1-prime-deep-research | The model for Deep Research. Any other model ID does not run Deep Research. |
Sample Usage
Request
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/responses" \
-d @- << EOF
{
"model": "plamo-3.1-prime-deep-research",
"input": "Research recent trends in generative AI regulation in Japan",
"background": true
}
EOFResponse
{
"id": "resp_3f9a1c...",
"object": "response",
"created_at": 1791272415.0,
"status": "queued",
"background": true,
"model": "plamo-3.1-prime-deep-research",
"output": [],
"usage": null,
"tool_usage": null,
"error": null,
"tools": [{"type": "web_search"}],
"max_tool_calls": 100,
"incomplete_details": null
}{
"id": "resp_3f9a1c...",
"object": "response",
"status": "completed",
"output": [
{
"type": "web_search_call",
"id": "ws_...",
"status": "completed",
"action": {"type": "search", "query": "generative AI regulation Japan", "queries": ["generative AI regulation Japan"]}
},
{
"type": "reasoning",
"id": "rs_...",
"summary": [{"type": "summary_text", "text": "..."}]
},
{
"type": "message",
"id": "msg_...",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "# Generative AI Regulation in Japan\n\n...",
"annotations": [
{"type": "url_citation", "start_index": 120, "end_index": 180, "url": "https://...", "title": "..."}
]
}
]
}
],
"usage": {"input_tokens": 182340, "output_tokens": 21530, "total_tokens": 203870},
"tool_usage": {"web_search": {"num_requests": 18}}
}Retrieving the Result
| Endpoint | Description |
|---|---|
GET /v1/responses/{id} | Returns the job's current Response object. status moves from queued to in_progress and ends as completed, incomplete, failed, or cancelled. |
GET /v1/responses/{id}?stream=true | Returns the progress as server-sent events, starting from the events that have already occurred. If the connection drops, pass the sequence_number of the last event you received as starting_after to resume from there. |
POST /v1/responses/{id}/cancel | Cancels the job. A cancelled job ends with status: "cancelled". |
The stream carries the same response.* events as the OpenAI Responses API. The main events are:
response.queued/response.in_progress/response.completedresponse.output_item.added/response.web_search_call.searchingresponse.reasoning_summary_text.deltaresponse.output_text.delta/response.output_text.annotation.added
Results are kept for 24 hours after creation. A job created by another tenant cannot be retrieved (404 is returned).
Request Parameters
Please include the following parameters in the request body in JSON format. Any parameter not listed here returns an error.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| model | string | required | Specify plamo-3.1-prime-deep-research. | |
| input | string or array of MessageObject | required | What to research. For an array, the last user message is the question, and assistant messages after it are used as the research plan. system messages are not used. | |
| background | boolean | required | Specify true. Any other value returns an error. | |
| stream | boolean | optional | false | true is not supported at creation. Get the progress with GET /v1/responses/{id}?stream=true. |
| tools | array | optional | null | Restricts the source domains in the form [{"type": "web_search", "filters": {"allowed_domains": [...], "blocked_domains": [...]}}]. No tool other than web_search and no option other than filters can be specified. |
| max_tool_calls | integer | optional | 100 | The maximum total number of searches, page opens, and in-page finds in one job. Valid values range from 1 to 100. Once the limit is reached, the remaining chapters are left out. |
| include | array of string | optional | null | Specify ["web_search_call.action.sources"] to include the search result URLs in action.sources of each web_search_call. |
| metadata | object | optional | null | Any string keys and values. |
| store | boolean | optional | null | Accepted for compatibility with the OpenAI Responses API. Regardless of the value, results are kept for 24 hours after creation. |
Notes
- A job runs for at most about 25 minutes. Past that, it ends with
status: "failed"anderror.code: "timeout". - If part of the research (such as writing a chapter heading) fails, that part is skipped, the report is written to the end, and the job ends with
status: "incomplete". What is missing is written in thesummaryof areasoningitem. - Charges are based on the tokens used to write the report and the number of searches in
tool_usage.web_search.num_requests.
Tokenize API
POST https://api.platform.preferredai.jp/v1/tokenize
Converts a given string into tokens and returns both the token sequence and the total number of tokens.
Note that in Chat Completion, the text will be converted to a chat format, so various prompts will be automatically inserted. Therefore, the token count returned here may not strictly match the actual number of tokens generated in the final text output.
Also, since PLaMo uses the same Tokenizer as this publicly available model, you can integrate similar functionality directly into your own system rather than using the API.
Example Usage
Request
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/tokenize" \
-d '{"prompt": "Hello", "model": "plamo-3.0-prime"}'Response
{
"count": 4,
"max_model_len": 16384,
"tokens": [
1,
1,
35913,
37607
]
}Request Parameters
Specify the following parameters in JSON format within the request body.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| model | string | yes | Specify the ID of the model to be used. | |
| prompt | string | Either messages or prompt must be specified | Specify the string for which you want to calculate tokens. | |
| messages | array of MessageObject | Either messages or prompt must be specified | Specify the strings for which you want to calculate tokens. The same format as chat messages used in the Chat Completions endpoint can be used. | |
| add_special_tokens | boolean | no | true | Specify whether to add special tokens like BOS. |
| add_generation_prompt | boolean | no | true | Specify whether to apply internal generation prompts during tokenization. This option is only valid when messages are specified. |
Response
| Field | Type | Description |
|---|---|---|
| count | integer | Total number of tokens. |
| max_model_len | integer | Maximum number of tokens the model can process. |
| tokens | array of integer | The actual token sequence. |
Models API
Retrieves data including available models.
Example
Request
For curl, set your PLaMo API key in the PLAMO_API_KEY environment variable, and for Python libraries, set it in the OPENAI_API_KEY environment variable.
$ curl \
-H "Authorization: Bearer ${PLAMO_API_KEY}" \
-H "Content-Type: application/json" \
"https://api.platform.preferredai.jp/v1/models"from openai import OpenAI
client = OpenAI(
base_url="https://api.platform.preferredai.jp/v1",
)
models = client.models.list()
print(models)
model_name = models.data[0].id
model = client.models.retrieve(model_name)
print(model)Response
{
"data": [
{
"id": "plamo-3.0-prime",
"created": 1732978800,
"object": "model",
"owned_by": "system",
"max_model_len": 262144
}
],
"object": "list"
}Index Models
GET https://api.platform.preferredai.jp/v1/models
Retrieves a list of available models.
Response
| Field | Type | Description |
|---|---|---|
| object | string | Always contains the value list. |
| data | array of ModelObject | Returns an array of model objects |
Get Model Details
GET https://api.platform.preferredai.jp/v1/models/{model}
Fetches detailed information about a specified model.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | yes | Specifies the ID of the model to retrieve. |
Response
Returns a ModelObject.
Object List
MessageObject
Represents a chat message, primarily consisting of System, User, and Assistant components.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| content | string | yes | Specifies the content of the message. | |
| role | string | yes | Indicates the role of the message; must be one of 'system', 'user', or 'assistant'. | |
| name | string | no | A name used for further identification when the same role is referenced. | |
| reasoning | string | no | Sets the reasoning provided in the response. | |
| reasoning_content | string | no | Sets the reasoning_content provided in the response. |
ReasoningObject
Specifies parameters related to reasoning.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| summary | string | no | null | Specifies whether to generate a summary of the reasoning content. Can be one of 'auto', 'concise', or 'detailed'. If not specified, summary generation is disabled. Note that tokens used for summary generation will be counted as token usage. |
| effort | none or medium | no | none | Allows selection of reasoning intensity. Supported options are none (no reasoning) or medium (standard amount of reasoning). Takes precedence over reasoning_effort. |
ResponseFormatObject
Specifies the response output format.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| type | string | yes | Must be set to json_schema. | |
| json_schema | ResponseFormatJsonSchemaObject | yes | Defines the JSON structure that the model should generate, expressed as JSON Schema. |
ResponseFormatJsonSchemaObject
Specifies the JSON Schema configuration used for Structured Outputs.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| name | string | yes | The name of the response format. | |
| description | string or null | no | null | A description of the response format. |
| schema | object | yes | The JSON Schema object that the response should follow. For the JSON Schema specification, see JSON Schema. | |
| strict | boolean | no | false | When set to true, the model will generate responses that strictly follow the structure defined by schema. Supported JSON Schema features are limited. |
StreamOptionObject
Specifies options when using streaming responses.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| include_usage | boolean | no | Specifies whether to return usage statistics just before the streaming response completes. |
ChatCompletionToolsObject
Defines the functions to be used with the Function Calling feature.
| Field | Type | Description |
|---|---|---|
| type | string | Must be set to 'function'. |
| function | ChatCompletionsToolsFunctionObject | Defines the actual function to be used with Function Calling. |
ChatCompletionToolsFunctionObject
Defines the actual function implementation.
| Field | Type | Description |
|---|---|---|
| name | string | The name of the function. |
| description | string | A description of the function. |
| parameters | string | Definition of arguments that can be passed to the function, expressed in JSON Schema. For details on JSON Schema, see: https://json-schema.org/understanding-json-schema |
ChatCompletionToolChoiceObject
Specifies which function to use.
| Field | Type | Description |
|---|---|---|
| type | string | Must be set to 'function'. |
| function | ChatCompletionToolChoiceFunctionObject | Specifies the function to use. |
ChatCompletionToolChoiceFunctionObject
Specifies the function details.
| Field | Type | Description |
|---|---|---|
| name | string | Specifies the name of the function specified in the 'tools' parameter. |
ChoiceObject
Represents the result of generating a response in chat format.
| Field | Type | Description |
|---|---|---|
| index | integer | Returns the index of the object when multiple ChoiceObjects are available. |
| finish_reason | 'stop' or 'length' | Returns 'stop' if the specified word was encountered or if generation naturally concluded; returns 'length' if the maximum token limit was exceeded. |
| logprobs | null | Currently not supported. |
| message | ChatMessageObject | Returns the content of the generated message. |
| stop_reason | integer, string, or null | Currently not supported. |
ChatMessageObject
Represents the content of a generated message.
| Field | Type | Description |
|---|---|---|
| content | string | Returns the message content. |
| reasoning | string or null | Returns the model's reasoning process. This field may only be present for models supporting reasoning. |
| reasoning_content | string or null | Contains the same content as reasoning. |
| annotations | array or null | With web search, returns the sources the answer cites as url_citation. See Web Search for details. |
| role | string | Returns the role of the message, which can be one of 'system', 'user', or 'assistant'. |
| tool_calls | ChatMessageToolCallsObject | Information about Function Calling generated by the model. |
ChatMessageToolCallsObject
Indicates the result of a function call.
| Field | Type | Description |
|---|---|---|
| id | string | A unique identifier. |
| type | string | Must be 'function'. |
| function | ChatMessageToolCallsFunctionObject | Information about the Function called via Function Calling. |
ChatMessageToolCallsFunctionObject
Information about the called Function.
| Field | Type | Description |
|---|---|---|
| name | string | Indicates the name of the Function. |
| arguments | string | Function arguments specified in JSON format. |
StreamChoiceObject
Represents the result of generated chat messages in a stream format.
| Field | Type | Description |
|---|---|---|
| index | integer | Returns the index of the object when multiple ChoiceObject instances exist. |
| finish_reason | 'stop' or 'length' | Returns stop if the specified word is encountered or generation ends naturally, and length if the maximum generated token count is exceeded. |
| logprobs | null | Currently not supported. |
| delta | ChatMessageDeltaObject | Returns the content of the additionally generated message. |
| stop_reason | integer or string or null | Currently not supported. |
ChatMessageDeltaObject
Represents the content of a message in a stream format.
| Field | Type | Description |
|---|---|---|
| content | string | Returns the content of the message. The content field may be absent in cases such as when a role assignment is emitted. |
| reasoning | string or null | Returns the model's reasoning process. This field may be present only for models that support reasoning. |
| reasoning_content | string or null | Contains the same content as reasoning. |
| annotations | array or null | With web search, returns the cited sources as url_citation. In streaming, it is included in the final chunk. |
| role | string | Returns the role of the message, which is one of system, user, or assistant. This field is set only when a new role is assigned. |
WebSearchOptionsObject
Specifies the web search settings.
| Parameter | Type | Required | Default Value | Description |
|---|---|---|---|---|
| search_context_size | low or medium or high | optional | medium | How much of the answer's context goes to search results: low uses 1/4, medium 1/2, and high all of it. |
| user_location | object or null | optional | null | The user's approximate location, in the form {"type": "approximate", "approximate": {"country": "JP", "city": "Tokyo", "region": "Tokyo", "timezone": "Asia/Tokyo"}}. Each field of approximate can be omitted. |
| filters | object or null | optional | null | Restricts the source domains in the form {"allowed_domains": ["example.com"]}. 1 to 100 domains can be specified. |
UsageObject
Indicates token generation results and related information.
| Field | Type | Description |
|---|---|---|
| completion_tokens | integer | Returns the number of generated tokens. |
PlamoUsageDetailObject
Indicates PLaMo-specific breakdown per model and usage type.
| Field | Type | Description |
|---|---|---|
| model | string | The model or pseudo-model name used (e.g. plamo-3.1-prime, web_search_basic). |
| usage_type | string | The usage type (e.g. main_response, web_search). |
| input_tokens | integer | Number of input tokens (or web search request count). |
| output_tokens | integer | Number of output tokens. |
| token_consumed | integer | Total consumed token count (or billing unit). |
ModelObject
Indicates information about a model.
| Field | Type | Description |
|---|---|---|
| id | string | A string that identifies the model. It can be used as an API parameter. |
| created | integer | The time when the model was created. |
| object | string | The type of this object. Currently, this field is always model. |
| owned_by | string | The owner of the model. Currently, this field is always system. |
| max_model_len | integer | The maximum number of tokens a single request can use, counting the prompt and the generated text together. |
Old API Endpoints
The API endpoints under https://platform.preferredai.jp/api/completion/v1 have been migrated. The new endpoint is https://api.platform.preferredai.jp/v1.
The old API endpoints remain available, but they are deprecated. Please use the new API endpoints.
