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

# Embeddings

> Transformez du texte et d’autres entrées en vecteurs avec POST /v1/embeddings depuis n’importe quel SDK Phaseo.

Envoyez du texte à `POST /v1/embeddings` pour recevoir un vecteur par entrée. Les exemples utilisent un `client` créé comme dans [Installation](https://phaseo.app/docs/fr/v1/sdk-reference/client/installation.md).

```typescript TypeScript theme={null}
const embedding = await client.generateEmbedding({
  model: "openai/text-embedding-3-large",
  input: "Sample text",
});
```

```python Python theme={null}
embedding = client.generate_embedding({
    "model": "openai/text-embedding-3-large",
    "input": "Sample text",
})
```

```go Go theme={null}
resp, err := client.GenerateEmbedding(context.Background(), map[string]interface{}{
  "model": "openai/text-embedding-3-large",
  "input": "Sample text",
})
if err != nil {
  panic(err)
}
fmt.Println(resp["data"])
```

```csharp C# theme={null}
var response = await client.CreateEmbedding(new Dictionary<string, object>
{
    ["model"] = "openai/text-embedding-3-large",
    ["input"] = "Sample text",
});
```

```php PHP theme={null}
$response = $client->generateEmbedding([
    'model' => 'openai/text-embedding-3-large',
    'input' => 'Sample text',
]);
```

```ruby Ruby theme={null}
response = client.generate_embedding(
  model: 'openai/text-embedding-3-large',
  input: 'Sample text'
)
```

```java Java theme={null}
String body = """
{
  "model": "openai/text-embedding-3-large",
  "input": "Sample text"
}
""";

Object response = client.createEmbedding(new com.fasterxml.jackson.databind.ObjectMapper().readTree(body));
System.out.println(String.valueOf(response));
```

```rust Rust theme={null}
// Pas encore de méthode embeddings : post() envoie du JSON vers n’importe quel chemin Phaseo.
let response = client.post("/embeddings", &json!({
    "model": "openai/text-embedding-3-large",
    "input": "Sample text"
}))?;
```

| Langage | Méthode | Renvoie |
| - | - | - |
| TypeScript | `client.generateEmbedding(request)` | La réponse typée |
| Python | `client.generate_embedding(request)` ou `client.embeddings.create(request)` | Un dict |
| Go | `client.GenerateEmbedding(ctx, req)`, alias `CreateEmbedding` | `map[string]interface{}` |
| C# | `client.CreateEmbedding(request)` | `Dictionary<string, object>?` |
| PHP | `$client->generateEmbedding($request)`, alias `createEmbedding()` | Un tableau |
| Ruby | `client.generate_embedding(...)`, alias `create_embedding` | Un Hash |
| Java | `client.createEmbedding(jsonNode)` | `Object` |
| Rust | `client.post("/embeddings", &request)` | `PhaseoResponse`, avec le JSON dans `body` |

## Paramètres

Les noms de champs sont ceux du corps JSON, dans tous les SDK.

| Champ | Remarques |
| - | - |
| `model` | Obligatoire. Un identifiant de modèle d’embedding. |
| `input` | Obligatoire. Une chaîne, un tableau de chaînes, ou des parties de contenu multimodales (texte, image, audio, vidéo) pour les modèles qui les acceptent. |
| `encoding_format` | `float` (par défaut), `base64`, `base64_int8` ou `base64_binary`. |
| `dimensions` | Un entier positif qui raccourcit chaque vecteur, sur les modèles qui le permettent. |
| `provider_options` | Réglages du fournisseur, comme `task_type` et `title` chez Google ou `output_dtype` chez Mistral. |
| `user` | Étiquette de l’utilisateur final. |

Le schéma complet se trouve dans la [référence de l’API Embeddings](https://phaseo.app/docs/fr/v1/api-reference/endpoint/embeddings.md).

## Réponse

```json theme={null}
{
  "data": [
    {
      "embedding": [0.1, 0.2, 0.3],
      "index": 0
    }
  ],
  "usage": {
    "input_tokens": 5,
    "output_tokens": 0,
    "total_tokens": 5,
    "embedding_tokens": 5
  }
}
```


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