> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Phaseo Gateway base URL: https://api.phaseo.app/v1. Send `Authorization: Bearer $PHASEO_API_KEY` with every request.
> Model IDs look like `provider/model`, for example `openai/gpt-6-astra`. Do not guess IDs: list them with `GET /v1/models` or check https://phaseo.app/models. `phaseo/free` routes to an available free model and needs no wallet balance.
> For new text integrations prefer `POST /v1/responses`. `POST /v1/chat/completions` (OpenAI format) and `POST /v1/messages` (Anthropic format) suit existing code.
> The full API contract is https://phaseo.app/docs/openapi/v1/openapi.yaml. Official SDKs: `@phaseo/sdk` (TypeScript) and `phaseo` (Python), plus Go, C#, PHP, Ruby and Rust.
> Search these docs over MCP at https://phaseo.app/docs/mcp, and install Phaseo skills with `npx skills add https://phaseo.app/docs`. If a page is wrong or out of date, report it with the MCP `submit_feedback` tool.
> Manage Phaseo accounts with the `phaseo` CLI (`npm install -g @phaseo/cli`, then `phaseo login` or `phaseo login --device-code`), the `/v1` Management API or the MCP server at `https://mcp.phaseo.app/mcp?access=manage`. Do not send users to the dashboard for account tasks. A person is still needed for sign-up, approving a sign-in, paying the first top-up on the checkout link that `phaseo credits add` returns when no card is saved, confirming each saved-card top-up from the emailed link, and account security (password, MFA, passkeys). Create API keys with `phaseo keys create --name <name> --json`; never guess one. Credit top-ups need `phaseo login --scopes billing:write` first. Task map: https://phaseo.app/docs/v1/developers/manage-from-an-agent.md.

# Agent SDK のインストール

> Phaseo Agent SDK をインストールし、その Gateway クライアントが使う API キーを設定します。

使用する言語の Agent SDK パッケージをインストールし、`PHASEO_API_KEY` を設定してから、[使い方](https://phaseo.app/docs/ja/v1/sdk-reference/agent/usage.md)で最初のエージェントを作成します。各パッケージは、その言語の Phaseo コアクライアントを依存関係として一緒にインストールします。

**1. パッケージをインストールする**

> [tab] TypeScript
>
> TypeScript または JavaScript のプロジェクトに [`@phaseo/agent-sdk`](https://www.npmjs.com/package/@phaseo/agent-sdk) 0.3.0 をインストールします。`@phaseo/sdk` も一緒にインストールされます。
>
> ```bash npm theme={null}
> npm install @phaseo/agent-sdk
> ```
>
> ```bash pnpm theme={null}
> pnpm add @phaseo/agent-sdk
> ```
>
> ```bash yarn theme={null}
> yarn add @phaseo/agent-sdk
> ```
>
> ```bash bun theme={null}
> bun add @phaseo/agent-sdk
> ```

> [tab] Python
>
> Python 3.10 以降の環境に [`phaseo-agent-sdk`](https://pypi.org/project/phaseo-agent-sdk/) 0.3.0 をインストールします。コアの `phaseo` クライアント（3.x）も一緒にインストールされ、パッケージは `phaseo_agent` モジュールとしてインストールされます。
>
> ```bash pip theme={null}
> pip install phaseo-agent-sdk
> ```
>
> ```bash uv theme={null}
> uv add phaseo-agent-sdk
> ```

> [tab] Go
>
> Go 1.24 以降で [`agent-sdk-go`](https://pkg.go.dev/github.com/phaseoteam/Phaseo/packages/sdk/agent-sdk-go) `v0.3.0` を追加します。Go はコアクライアント `github.com/phaseoteam/Phaseo/packages/sdk/sdk-go/v3` を依存関係として追加します。
>
> ```bash theme={null}
> go get github.com/phaseoteam/Phaseo/packages/sdk/agent-sdk-go@latest
> ```
>
> エージェントパッケージを `phaseoagent` としてインポートします。
>
> ```go theme={null}
> import phaseoagent "github.com/phaseoteam/Phaseo/packages/sdk/agent-sdk-go"
> ```

> [tab] C#
>
> NuGet から [`Phaseo.AgentSdk`](https://www.nuget.org/packages/Phaseo.AgentSdk) 0.3.0 を追加します。.NET 8 以降が必要です。NuGet は `Phaseo.Sdk` を依存関係として追加します。
>
> ```bash theme={null}
> dotnet add package Phaseo.AgentSdk
> ```
>
> エージェントの型は `PhaseoAgentSdk` 名前空間にあります。
>
> ```csharp theme={null}
> using PhaseoAgentSdk;
> ```

> [tab] PHP
>
> Composer で [`phaseo/agent-sdk`](https://packagist.org/packages/phaseo/agent-sdk) `v0.3.0` を追加します。PHP 8.1 以降が必要です。Composer は `phaseo/sdk`（`^3.0.0`）を依存関係として追加します。
>
> ```bash theme={null}
> composer require phaseo/agent-sdk
> ```
>
> エージェントのクラスは `Phaseo\AgentSdk` 名前空間にあります。
>
> ```php theme={null}
> use Phaseo\AgentSdk\AgentDefinition;
> use Phaseo\AgentSdk\AgentSdk;
> use Phaseo\AgentSdk\Tool;
> ```

> [tab] Ruby
>
> RubyGems または Bundler で [`phaseo_agent_sdk`](https://rubygems.org/gems/phaseo_agent_sdk) 0.3.0 を追加します。Ruby 3.2 以降が必要です。RubyGems は `phaseo_sdk`（`>= 3.0.0, < 4.0.0`）を依存関係として追加します。
>
> ```bash gem theme={null}
> gem install phaseo_agent_sdk
> ```
>
> ```ruby Gemfile theme={null}
> gem "phaseo_agent_sdk"
> ```
>
> 次のようにエージェントモジュールを読み込みます。
>
> ```ruby theme={null}
> require "phaseo_agent_sdk"
> ```

> [tab] Java
>
> Maven Central から `app.phaseo:phaseo-agent-sdk` 0.3.0 を追加します。Java 17 以降が必要です。ビルドは `app.phaseo:phaseo-sdk` 3.0.0 と Jackson を依存関係として追加します。すべての型は `app.phaseo.agent.AgentSdk` 内のネストされたレコードです。
>
> ```xml Maven theme={null}
> <dependency>
>   <groupId>app.phaseo</groupId>
>   <artifactId>phaseo-agent-sdk</artifactId>
>   <version>0.3.0</version>
> </dependency>
> ```
>
> ```kotlin Gradle theme={null}
> implementation("app.phaseo:phaseo-agent-sdk:0.3.0")
> ```
>
> 代わりにソースからビルドする場合は、次のようにします。
>
> ```bash theme={null}
> git clone https://github.com/phaseoteam/Phaseo.git
> cd Phaseo
> mvn -f packages/sdk/agent-sdk-java/pom.xml package
> ```

> [tab] Rust
>
> Rust 1.86 以降で、crates.io にある [`phaseo-agent`](https://crates.io/crates/phaseo-agent) と `phaseo` クライアント（どちらも 0.2.0）を追加します。他の言語と異なり、コアクライアントは自分で追加します。
>
> ```toml Cargo.toml theme={null}
> [dependencies]
> phaseo = "0.2"
> phaseo-agent = "0.2"
> serde_json = "1"
> ```
>
> ```bash cargo theme={null}
> cargo add phaseo@0.2 phaseo-agent@0.2 serde_json
> ```

**2. API キーを設定する**

[API キー](https://phaseo.app/settings/keys)でキーを作成し、エクスポートします。

```bash macOS と Linux theme={null}
export PHASEO_API_KEY="phaseo_v1_sk_..."
```

```powershell Windows theme={null}
$env:PHASEO_API_KEY = "phaseo_v1_sk_..."
```

ほとんどの Gateway クライアントは環境変数からキーを読み取りますが、Python のクライアントは読み取りません。TypeScript、Python、Java は `PHASEO_BASE_URL` を無視します。

| 言語 | Gateway クライアント | `PHASEO_API_KEY` を読み取る | `PHASEO_BASE_URL` を読み取る | コードで渡す方法 |
| - | - | - | - | - |
| TypeScript | `createGatewayAgentClient()` | はい | いいえ | `clientOptions.apiKey`、`clientOptions.baseUrl` |
| Python | `create_gateway_agent_client()` | いいえ。キーがないと `ValueError` を送出 | いいえ | `client_options={"api_key": ...}` または `client=Phaseo()` |
| Go | `CreateGatewayAgentClient(...)` | はい（`APIKey` が空の場合） | はい（`BaseURL` が空の場合） | `GatewayAgentClientOptions.APIKey`、`.BaseURL` |
| C# | `AgentSdk.CreateGatewayAgentClient()` | はい | はい | `GatewayAgentClientOptions.ClientOptions` の `apiKey`、`baseUrl` |
| PHP | `AgentSdk::createGatewayAgentClient()` | はい | はい | `GatewayAgentClientOptions::$clientOptions` の `api_key`、`base_url` |
| Ruby | `PhaseoAgentSdk.create_gateway_agent_client` | はい | はい | `api_key:`、`base_url:` |
| Java | `AgentSdk.createGatewayAgentClient()` | はい | いいえ | `new AgentSdk.GatewayOptions(null, apiKey, baseUrl, null, null, null)` |
| Rust | `create_gateway_agent_client(model)`、`GatewayAgentClient::from_env(model)` | はい | はい（`phaseo` クライアント経由） | `GatewayAgentClient::new(client, model)` |

デフォルトのベース URL は `https://api.phaseo.app/v1` です。

**3. インストールを確認する**

モデルを呼び出さずにエージェントを作成します。これがコンパイルされて実行できれば、パッケージはインストールされています。

```typescript TypeScript theme={null}
import { createAgent } from "@phaseo/agent-sdk";

createAgent({ id: "verification-agent", model: "openai/gpt-6-astra" });
console.log("Phaseo Agent SDK installed");
```

```python Python theme={null}
from phaseo_agent import create_agent

create_agent({"id": "verification-agent", "model": "openai/gpt-6-astra"})
print("Phaseo Agent SDK installed")
```

```go Go theme={null}
package main

import (
  "fmt"

  phaseoagent "github.com/phaseoteam/Phaseo/packages/sdk/agent-sdk-go"
)

func main() {
  phaseoagent.CreateAgent(phaseoagent.AgentDefinition{ID: "verification-agent", Model: "openai/gpt-6-astra"})
  fmt.Println("Phaseo Agent SDK installed")
}
```

```csharp C# theme={null}
using PhaseoAgentSdk;

AgentSdk.CreateAgent(new AgentDefinition { Id = "verification-agent", Model = "openai/gpt-6-astra" });
Console.WriteLine("Phaseo Agent SDK installed");
```

```php PHP theme={null}
<?php
require "vendor/autoload.php";

use Phaseo\AgentSdk\AgentDefinition;
use Phaseo\AgentSdk\AgentSdk;

AgentSdk::createAgent(new AgentDefinition(id: "verification-agent", model: "openai/gpt-6-astra"));
echo "Phaseo Agent SDK installed" . PHP_EOL;
```

```ruby Ruby theme={null}
require "phaseo_agent_sdk"

PhaseoAgentSdk.create_agent(id: "verification-agent", model: "openai/gpt-6-astra")
puts "Phaseo Agent SDK installed"
```

```rust Rust theme={null}
use phaseo_agent::{create_agent, AgentDefinition};

fn main() {
    let _agent = create_agent(AgentDefinition::new(
        "verification-agent",
        "openai/gpt-6-astra",
    ));
    println!("Phaseo Rust Agent SDK installed");
}
```

Java には短い書き方がありません。`AgentDefinition` は位置引数のレコードで、全体は[使い方](https://phaseo.app/docs/ja/v1/sdk-reference/agent/usage.md)に示しています。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.