promptstring必須
The question or prompt to answer with Google AI Mode.
https://api.sandbase.ai/v1/api/google/ai-modeAsk Google AI Mode a prompt and receive the cited answer it generates. AI Mode composes the answer at search time, so repeat calls on one prompt can differ in wording and in which sources are cited.
出力はここに表示されます
入力を完了してから[実行]をクリックしてください。
Returns the answer Google AI Mode generates for a text prompt, plus the sources it cites. It needs one input, a prompt string with the question to answer.
curl -X POST "https://api.sandbase.ai/v1/api/google/ai-mode" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "What is the Model Context Protocol and who maintains it?"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The question or prompt to answer with Google AI Mode. |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"answer": "The Model Context Protocol (MCP) is an open standard and open-source framework d…",
"answerMarkdown": "The Model Context Protocol (MCP) is an open standard and open-source framework d…",
"citations": [
{
"title": "Wikipedia",
"url": "https://en.wikipedia.org/wiki/Model_Context_Protocol"
}
],
"prompt": "What is the Model Context Protocol and who maintains it?"
},
"found": true
}
| Field | Meaning |
|---|---|
data.answer | The generated answer as plain text. |
data.answerMarkdown | The same answer in Markdown. Use it when you want to keep the formatting of the answer. |
data.citations[] | List of sources cited in the answer. |
data.citations[].title | Title of the cited source, such as a site or page name. |
data.citations[].url | Link to the cited page. |
data.prompt | The prompt that the answer was generated for. It repeats the prompt you sent. |
found | true when AI Mode returned a result for the prompt. |
prompt. The request takes no other parameters and has no pagination.outputs[0].data.Billed at the actual cost of each call, about $0.002 for the request above. Failed calls are not charged.
開発を始める
統一認証と使用状況の追跡を備えたプラットフォームAPIエンドポイントです。
curl -X POST "https://api.sandbase.ai/v1/api/google/ai-mode" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What is the Model Context Protocol and who maintains it?"
}'SandBaseのAPIキーをサーバー環境に設定してください。リクエストはBearer認証を使用します。
export SANDBASE_API_KEY="YOUR_API_KEY"キーはサーバー側で管理してください。ブラウザコードに公開しないでください。
promptstring必須The question or prompt to answer with Google AI Mode.
このAPIの保存済みサンプルレスポンスです。表示時にライブリクエストは行われません。
保存済みレスポンスはまだ公開されていません。PlaygroundでAPIを実行し、レスポンスを確認してください。
さらに探索
| API | 価格 | レスポンス |
|---|---|---|
Google AI Modeこの API Google | 1回あたり $0.002 から | JSON |
Google | $0.01 / 回 | JSON |
Google | $0.015 / 回 | JSON |
Google | 1回あたり $0.0015 から | JSON |
Google | $0.01 / 回 | JSON |
Google | $0.01 / 回 | JSON |
質問
Authorization ヘッダー(Bearer)に SandBase API key を指定し、パラメータを JSON ボディで送信して https://api.sandbase.ai/v1/api/google/ai-mode に POST リクエストを送ります。このページの Playground で、コードを書かずに試すこともできます。
1回あたり $0.002 から、SandBase 残高から課金されます。課金対象はご利用分のみで、サブスクリプションはありません。
必須: prompt (string)。 このページの Parameters テーブルと Playground に、すべてのフィールドが一覧表示されています。
同じ HTTP リクエスト内で返される JSON レスポンスです(同期)。 このページの README にサンプルレスポンスがあります。
いいえ。Google AI Mode は SandBase 経由で動作するため、SandBase の API key 1つでこのエンドポイントと、カタログ内の他のすべての API とモデルを利用できます。Google の API アクセスを別途申請する必要はありません。