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

# Werte extrahieren

> Extrahiere typisierte Werte aus Text und Bildern.

> [!WARNING]
>
> Die Extraktion ist eine Vorschau. Die Modellverfügbarkeit hängt von den konfigurierten Anbieterrouten ab.

Benenne die gewünschten `fields` und sende sie zusammen mit deinem Quelltext an `POST /v1/extractions`, um typisierte Werte zurückzubekommen, etwa eine Rechnungsnummer, ein Datum oder eine Gesamtsumme. Um stattdessen zwischen bekannten Optionen zu wählen, verwende [Decisions](https://phaseo.app/docs/de/v1/api-reference/endpoint/decisions.md).

```bash cURL theme={null}
curl https://api.phaseo.app/v1/extractions \
  -H "Authorization: Bearer $PHASEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cloudflare/clairic",
    "input": "Invoice INV-2291: 4 pallets at $250 each, shipping $80.",
    "fields": {
      "invoice_number": { "type": "text" },
      "total": { "type": "number", "decimals": 2, "instructions": "Total including shipping" }
    }
  }'
```

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

const client = new Phaseo({ apiKey: process.env.PHASEO_API_KEY });
const result = await client.extractions.create({
  model: "cloudflare/clairic",
  input: "Invoice INV-2291: 4 pallets at $250 each, shipping $80.",
  fields: {
    invoice_number: { type: "text" },
    total: { type: "number", decimals: 2, instructions: "Total including shipping" },
  },
});
console.log(result.answers.total.value);
```

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

client = Phaseo(api_key=os.environ["PHASEO_API_KEY"])
result = client.extractions.create({
    "model": "cloudflare/clairic",
    "input": "Invoice INV-2291: 4 pallets at $250 each, shipping $80.",
    "fields": {"total": {"type": "number", "decimals": 2,
                         "instructions": "Total including shipping"}},
})
print(result["answers"]["total"]["value"])
```

Die Beispiele benötigen eine aktive Route für ein Extraktionsmodell, prüfe also die
Modellverfügbarkeit, bevor du Anfragen sendest. Python `AsyncPhaseo` stellt außerdem
`await client.extractions.create(...)` bereit.

## Feldtypen

Unterstützte Typen sind `text`, `number`, `date`, `time`, `datetime`, `duration` und
`list`. Listen erfordern `items: "text"`, `"number"` oder `"date"`. Gib 1–64 Felder
und höchstens 16.384 Zeichen Quelltext an. Feldnamen beginnen mit einem Buchstaben oder Unterstrich
und enthalten bis zu 64 Buchstaben, Ziffern, Unterstriche, Punkte oder Bindestriche.

Zahlen und Zeitdauern unterstützen `integer` und `decimals` (0–6). Zeitdauern akzeptieren
`seconds`, `minutes`, `hours`, `days`, `weeks`, `months` oder `years`. Setze
`reference_date`, wenn die Deutung unvollständiger Datumsangaben von einem bestimmten Jahr abhängt.

Bildeingaben verwenden `{ content_type, base64 }`-Objekte: höchstens vier PNG-/JPEG-/WebP-Bilder,
jeweils 4 MiB und zusammen 8 MiB nach dem Dekodieren. PDFs gehören als
`{ content_type: "application/pdf", base64 }`-Objekte in `documents`, jeweils 4 MiB. Bilder und
gerenderte PDF-Seiten dürfen zusammen höchstens vier sein, und Bilder und PDFs teilen sich das Limit von 8 MiB.
Verschlüsselte PDFs werden abgelehnt. Das Anfragelimit liegt bei 16 MiB.
Externe URLs, Audio, Video, Schätzungen, Prognosen und Streaming werden nicht unterstützt.

## Antworten lesen

Lies `answers[field_name].value`. Ein skalarer Wert kann `null` sein, wenn die Quelle
ihn nicht festlegt. `p_null` ist die Wahrscheinlichkeit des Modells für einen unbestimmten Wert;
`confidence` ist ein separater, vom Modell gemeldeter Wert. Listen liefern Konfidenz ohne
`p_null`. Diese Werte garantieren keine Korrektheit: Wähle Prüfschwellen für
deine Arbeitslast. Eine gültige leere Liste ist etwas anderes als eine fehlgeschlagene Anfrage.

`truncated: true` bedeutet, dass der Anbieter nicht die gesamte Quelleingabe verarbeitet hat. Prüfe die Eingabe
oder sende eine kürzere erneut, bevor du dich auf Vollständigkeit verlässt. Textpositionen und Rohschätzungen
werden nicht bereitgestellt. Komplexe Berechnungen solltest du im Anwendungscode durchführen.

Die Nutzung meldet `input_tokens` aufsummiert über alle Anbieterdurchläufe. Ausgabe-Tokens werden
gemeldet, aber nicht berechnet. Verwende die vom Gateway zurückgegebenen Preise, statt die Kosten aus der Quelllänge zu schätzen
oder die Nutzung mit der Anzahl der Felder zu multiplizieren.


## OpenAPI

````yaml de/openapi/v1/openapi.localized.yaml POST /extractions
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: >-
    Eine Gateway-API für den Zugriff auf verschiedene KI-Modelle über
    OpenAI-kompatible Endpunkte.
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: Globales Routing
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /extractions:
    post:
      tags:
        - Gateway
      summary: Typisierte Werte extrahieren
      description: >-
        Extrahiert Text, Zahlen, Datumsangaben, Uhrzeiten, Zeitspannen und
        typisierte Listen aus Text oder eingebetteten Bildern. Gibt typisierte
        Werte und die vom Modell gemeldete Unsicherheit zurück. Schätzungen,
        Prognosen, Streaming und URLs entfernter Bilder werden nicht
        unterstützt.
      operationId: createExtraction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtractionRequest'
      responses:
        '200':
          description: Typisierte Extraktionsantworten
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExtractionResponse'
components:
  schemas:
    ExtractionRequest:
      type: object
      additionalProperties: false
      required:
        - model
        - input
        - fields
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 256
          description: Modell-ID mit der Fähigkeit extraction.extract.
        input:
          type: string
          maxLength: 16384
          description: >-
            Quelltext. Darf leer sein, wenn Bilder oder Dokumente übergeben
            werden.
        fields:
          type: object
          minProperties: 1
          maxProperties: 64
          description: Feldnamen entsprechen ^[A-Za-z_][A-Za-z0-9_.-]{0,63}$.
          additionalProperties:
            $ref: '#/components/schemas/ExtractionField'
        images:
          type: array
          maxItems: 4
          description: >-
            Eingebettete PNG-, JPEG- oder WebP-Bilder; nach dem Dekodieren 4 MiB
            pro Bild und insgesamt 8 MiB.
          items:
            $ref: '#/components/schemas/ExtractionImage'
        documents:
          type: array
          maxItems: 4
          description: >-
            Eingebettete PDF-Dokumente; 4 MiB pro Dokument. Bilder und
            gerenderte PDF-Seiten dürfen zusammen höchstens 4 sein, und Bilder
            und Dokumente teilen sich das Limit von 8 MiB nach dem Dekodieren.
          items:
            $ref: '#/components/schemas/ExtractionDocument'
        reference_date:
          type: string
          format: date
          description: Expliziter Datumskontext für unvollständige Datumsangaben.
    ExtractionResponse:
      type: object
      required:
        - model
        - answers
        - truncated
        - usage
      properties:
        model:
          type: string
        answers:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ExtractionAnswer'
        truncated:
          type: boolean
          description: Gibt an, ob der Anbieter den Quelltext gekürzt hat.
        usage:
          $ref: '#/components/schemas/ExtractionUsage'
    ExtractionField:
      oneOf:
        - $ref: '#/components/schemas/ExtractionTextField'
        - $ref: '#/components/schemas/ExtractionNumberField'
        - $ref: '#/components/schemas/ExtractionDateField'
        - $ref: '#/components/schemas/ExtractionTimeField'
        - $ref: '#/components/schemas/ExtractionDatetimeField'
        - $ref: '#/components/schemas/ExtractionDurationField'
        - $ref: '#/components/schemas/ExtractionListField'
    ExtractionImage:
      type: object
      additionalProperties: false
      required:
        - content_type
        - base64
      properties:
        content_type:
          type: string
          enum:
            - image/png
            - image/jpeg
            - image/webp
        base64:
          type: string
          maxLength: 5592408
          description: Base64-kodierte Bilddaten ohne Daten-URL-Präfix.
    ExtractionDocument:
      type: object
      additionalProperties: false
      required:
        - content_type
        - base64
      properties:
        content_type:
          type: string
          enum:
            - application/pdf
        base64:
          type: string
          maxLength: 5592408
          description: Base64-kodierte PDF-Daten ohne Daten-URL-Präfix.
    ExtractionAnswer:
      oneOf:
        - $ref: '#/components/schemas/ExtractionStringAnswer'
        - $ref: '#/components/schemas/ExtractionNumberAnswer'
        - $ref: '#/components/schemas/ExtractionListAnswer'
    ExtractionUsage:
      type: object
      required:
        - input_tokens
        - output_tokens
        - total_tokens
      properties:
        input_tokens:
          type: integer
          minimum: 0
          description: Vom Anbieter gemeldete Summe der Eingabetokens über alle Durchläufe.
        output_tokens:
          type: integer
          minimum: 0
          description: >-
            Vom Anbieter gemeldete Ausgabetokens für dekodierte Feldwerte.
            Ausgabetokens werden nicht berechnet.
        total_tokens:
          type: integer
          minimum: 0
    ExtractionTextField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
        instructions:
          type: string
          maxLength: 2048
    ExtractionNumberField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - number
        instructions:
          type: string
          maxLength: 2048
        integer:
          type: boolean
        decimals:
          type: integer
          minimum: 0
          maximum: 6
        unit:
          type: string
          maxLength: 64
    ExtractionDateField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - date
        instructions:
          type: string
          maxLength: 2048
    ExtractionTimeField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - time
        instructions:
          type: string
          maxLength: 2048
    ExtractionDatetimeField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - datetime
        instructions:
          type: string
          maxLength: 2048
    ExtractionDurationField:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - duration
        instructions:
          type: string
          maxLength: 2048
        integer:
          type: boolean
        decimals:
          type: integer
          minimum: 0
          maximum: 6
        unit:
          type: string
          enum:
            - seconds
            - minutes
            - hours
            - days
            - weeks
            - months
            - years
    ExtractionListField:
      type: object
      additionalProperties: false
      required:
        - type
        - items
      properties:
        type:
          type: string
          enum:
            - list
        instructions:
          type: string
          maxLength: 2048
        items:
          type: string
          enum:
            - text
            - number
            - date
        decimals:
          type: integer
          minimum: 0
          maximum: 6
    ExtractionStringAnswer:
      type: object
      required:
        - type
        - value
        - confidence
        - p_null
      properties:
        type:
          type: string
          enum:
            - text
            - date
            - time
            - datetime
        value:
          type: string
          description: >-
            Extrahierter Text oder ISO-Datum/-Uhrzeit; null bei unbestimmtem
            Wert.
          nullable: true
        confidence:
          type: number
          minimum: 0
          maximum: 1
          description: Vom Modell gemeldete Konfidenz; keine Garantie für Richtigkeit.
        p_null:
          type: number
          minimum: 0
          maximum: 1
          description: Wahrscheinlichkeit, dass der Wert unbestimmt ist.
    ExtractionNumberAnswer:
      type: object
      required:
        - type
        - value
        - confidence
        - p_null
      properties:
        type:
          type: string
          enum:
            - number
            - duration
        value:
          type: number
          nullable: true
        confidence:
          type: number
          minimum: 0
          maximum: 1
        p_null:
          type: number
          minimum: 0
          maximum: 1
    ExtractionListAnswer:
      type: object
      required:
        - type
        - value
        - confidence
      properties:
        type:
          type: string
          enum:
            - list
        value:
          type: array
          maxItems: 4096
          items:
            oneOf:
              - type: string
              - type: number
        confidence:
          type: number
          minimum: 0
          maximum: 1
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authentifizierung mit Bearer-Token

````

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