> ## 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.

# क्लाइंट SDK इंस्टॉल करें

> Phaseo क्लाइंट SDK इंस्टॉल करें, अपनी API कुंजी सेट करें और पहला अनुरोध भेजें।

अपनी भाषा का Phaseo पैकेज जोड़ें, `PHASEO_API_KEY` सेट करें, और अपना पहला अनुरोध भेजें। [परिचय](https://phaseo.app/docs/hi/v1/sdk-reference/client/overview.md) हर पैकेज की रजिस्ट्री और प्रकाशित वर्ज़न की सूची देता है।

**1. पैकेज इंस्टॉल करें**

> [tab] TypeScript
>
> ```bash title="npm" theme={null}
> npm install @phaseo/sdk
> ```
>
> ```bash title="pnpm" theme={null}
> pnpm add @phaseo/sdk
> ```
>
> ```bash title="yarn" theme={null}
> yarn add @phaseo/sdk
> ```
>
> आपको Node.js 18 या बाद का वर्ज़न चाहिए, और टाइप डेफ़िनिशन के लिए TypeScript 4.5 या बाद का वर्ज़न।

> [tab] Python
>
> ```bash title="pip" theme={null}
> pip install phaseo
> ```
>
> ```bash title="uv" theme={null}
> uv add phaseo
> ```
>
> आपको Python 3.10 या बाद का वर्ज़न चाहिए। [रियलटाइम वॉइस](https://phaseo.app/docs/hi/v1/sdk-reference/client/audio-realtime.md) के लिए extra इंस्टॉल करें: `pip install "phaseo[realtime]"`।

> [tab] Go
>
> ```bash theme={null}
> go get github.com/phaseoteam/Phaseo/packages/sdk/sdk-go/v3@latest
> ```
>
> आपको Go 1.23 या बाद का वर्ज़न चाहिए। `v3` मॉड्यूल पाथ इम्पोर्ट करें:
>
> ```go theme={null}
> import phaseo "github.com/phaseoteam/Phaseo/packages/sdk/sdk-go/v3"
> ```

> [tab] C#
>
> ```bash theme={null}
> dotnet add package Phaseo.Sdk
> ```
>
> आपको .NET 8 या बाद का वर्ज़न चाहिए। क्लाइंट `PhaseoSdk` namespace में है।

> [tab] PHP
>
> ```bash theme={null}
> composer require phaseo/sdk
> ```
>
> आपको PHP 8.1 या बाद का वर्ज़न और Composer चाहिए। Composer, Guzzle 7 भी इंस्टॉल करता है। क्लाइंट क्लास `Phaseo\Sdk\Phaseo` है।

> [tab] Ruby
>
> ```bash title="gem" theme={null}
> gem install phaseo_sdk
> ```
>
> ```ruby title="Gemfile" theme={null}
> gem "phaseo_sdk"
> ```
>
> आपको Ruby 3.0 या बाद का वर्ज़न चाहिए। इसे `require 'phaseo_sdk'` से लोड करें; क्लाइंट `PhaseoSdk::Phaseo` है।

> [tab] Java
>
> [Maven Central](https://repo.maven.apache.org/maven2/app/phaseo/phaseo-sdk/3.0.0/) पर मौजूद `3.0.0` artifact में पुराना API है, जिसमें मौजूदा retry, प्रतिक्रिया मेटाडेटा और पैरामीटर-जाँच वाले API नहीं हैं। मौजूदा SDK इस्तेमाल करने के लिए पिन किया गया सोर्स बिल्ड करें। आपको Java 17 या बाद का वर्ज़न, Maven 3.8 या बाद का वर्ज़न, और Git चाहिए।
>
> ```bash theme={null}
> git clone https://github.com/phaseoteam/Phaseo.git
> cd Phaseo
> git checkout 1ff1119f41ceb3ac2c85ed605f6e1c4beca6e011
> mvn -f packages/sdk/sdk-java/pom.xml -DskipTests install
> ```
>
> Maven आपकी लोकल रिपॉज़िटरी में `app.phaseo:phaseo-sdk:3.0.0` इंस्टॉल करता है, उसकी Jackson डिपेंडेंसी समेत। फिर डिपेंडेंसी जोड़ें:
>
> ```xml theme={null}
> <dependency>
>   <groupId>app.phaseo</groupId>
>   <artifactId>phaseo-sdk</artifactId>
>   <version>3.0.0</version>
> </dependency>
> ```

> [tab] Rust
>
> ```toml title="Cargo.toml" theme={null}
> [dependencies]
> phaseo = "0.2"
> serde_json = "1"
> ```
>
> ```bash title="cargo" theme={null}
> cargo add phaseo@0.2 serde_json
> ```
>
> आपको Rust 1.86 या बाद का वर्ज़न चाहिए। crate अभी `1.0` से पहले का है, और इसका API अभी भी माइनर वर्ज़न के बीच बदल सकता है, इसलिए प्रोडक्शन में एक संगत माइनर वर्ज़न पिन करें।

**2. अपनी API कुंजी सेट करें**

[Phaseo CLI](https://phaseo.app/docs/hi/v1/guides/integrations/phaseo-cli.md) में `phaseo keys create` से या [API कुंजियाँ](https://phaseo.app/settings/keys) में एक कुंजी बनाएँ, फिर उसे export करें:

```bash title="bash" theme={null}
export PHASEO_API_KEY="phaseo_v1_sk_<kid>_<secret>"
```

```powershell title="PowerShell" theme={null}
$env:PHASEO_API_KEY = "phaseo_v1_sk_<kid>_<secret>"
```

कुंजी अपने सर्वर पर रखें। इसे डेस्कटॉप, मोबाइल, ब्राउज़र या किसी दूसरे वितरित क्लाइंट में कंपाइल न करें।

**3. अनुरोध भेजें**

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

const client = new Phaseo({
  apiKey: process.env.PHASEO_API_KEY!,
});

const response = await client.generateText({
  model: "openai/gpt-6-astra",
  messages: [{ role: "user", content: "Hello!" }],
});

console.log(response.choices[0].message.content);
```

```python Python theme={null}
from phaseo import Phaseo
import os

client = Phaseo(api_key=os.environ["PHASEO_API_KEY"])

response = client.generate_text(
    {
        "model": "openai/gpt-6-astra",
        "messages": [{"role": "user", "content": "Hello!"}],
    }
)

print(response["choices"][0]["message"]["content"])
```

```go Go theme={null}
client, err := phaseo.NewFromEnv() // PHASEO_API_KEY पढ़ता है
if err != nil {
  panic(err)
}

chat, err := client.GenerateText(context.Background(), phaseo.ChatCompletionsRequest{
  Model:    "openai/gpt-6-astra",
  Messages: []map[string]interface{}{{"role": "user", "content": "Hello!"}},
})
if err != nil {
  panic(err)
}
fmt.Println(chat["choices"])
```

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

var client = new Phaseo(); // PHASEO_API_KEY पढ़ता है

var chat = await client.GenerateText(new Dictionary<string, object>
{
    ["model"] = "openai/gpt-6-astra",
    ["messages"] = new[]
    {
        new Dictionary<string, object> { ["role"] = "user", ["content"] = "Hello!" },
    },
});
```

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

use Phaseo\Sdk\Phaseo;

$client = new Phaseo(); // PHASEO_API_KEY पढ़ता है

$chat = $client->generateText([
    'model' => 'openai/gpt-6-astra',
    'messages' => [['role' => 'user', 'content' => 'Hello!']],
]);

echo $chat['choices'][0]['message']['content'];
```

```ruby Ruby theme={null}
require 'phaseo_sdk'

client = PhaseoSdk::Phaseo.new # PHASEO_API_KEY पढ़ता है

chat = client.generate_text(
  model: 'openai/gpt-6-astra',
  messages: [{ role: 'user', content: 'Hello!' }]
)
```

```java Java theme={null}
import app.phaseo.sdk.Phaseo;
import java.util.List;
import java.util.Map;

Phaseo client = new Phaseo(System.getenv("PHASEO_API_KEY"));

var chat = client.createChatCompletion(Map.of(
    "model", "openai/gpt-6-astra",
    "messages", List.of(Map.of("role", "user", "content", "Hello!"))
));
System.out.println(chat.path("choices").path(0).path("message").path("content").asText());
```

```rust Rust theme={null}
use phaseo::Phaseo;
use serde_json::json;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Phaseo::from_env()?;
    let response = client.chat_completions(&json!({
        "model": "openai/gpt-6-astra",
        "messages": [{ "role": "user", "content": "Hello!" }]
    }))?;

    println!("{}", response.body);
    Ok(())
}
```

अगर आप कुंजी नहीं देते, तो क्लाइंट `PHASEO_API_KEY` ख़ुद पढ़ लेता है।

## क्लाइंट को दूसरे बेस URL पर भेजें

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

const client = new Phaseo({
  apiKey: "your-api-key",
  baseUrl: "https://api.phaseo.app/v1",
  timeoutMs: 30_000,
});
```

```python Python theme={null}
from phaseo import Phaseo

client = Phaseo(
    api_key="your-api-key",
    base_url="https://api.phaseo.app/v1",
    timeout=30.0,
)
```

```go Go theme={null}
client := phaseo.New(os.Getenv("PHASEO_API_KEY"), "https://api.phaseo.app/v1")
```

```rust Rust theme={null}
let client = Phaseo::from_env()?.with_base_url("http://localhost:8787/v1")?;
```

टाइमआउट TypeScript में मिलीसेकंड (`timeoutMs`) में और Python में सेकंड (`timeout`) में होता है। Rust में आप `PHASEO_BASE_URL` (उदाहरण के लिए `http://localhost:8787/v1`) भी सेट कर सकते हैं, जिसे `Phaseo::from_env()` उठा लेता है। Rust सादा HTTP सिर्फ़ तब स्वीकार करता है जब होस्ट ठीक `localhost` या loopback IP पता हो; रिमोट एंडपॉइंट को HTTPS इस्तेमाल करना होगा।

[परिचय](https://phaseo.app/docs/hi/v1/sdk-reference/client/overview.md#configure-the-client) हर भाषा के सभी विकल्पों की सूची देता है। आगे, हर एंडपॉइंट के एक उदाहरण के लिए [उपयोग](https://phaseo.app/docs/hi/v1/sdk-reference/client/usage.md) देखें, या हर फ़ील्ड के लिए [API संदर्भ](https://phaseo.app/docs/hi/v1/api-reference/introduction.md)।


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