Zum Inhalt springen
DeutschlandGPT

Create embeddings

Creates an embedding vector representing input text. Compatible with the OpenAI /v1/embeddings API.

Pass a single string or an array of strings. The response contains one embedding vector per input.

POSThttps://api.deutschlandgpt.de/v2/embeddingsTry it

Example request

curl https://api.deutschlandgpt.de/v2/embeddings \
  -X POST \
  -H "Authorization: Bearer $DGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "The quick brown fox jumps over the lazy dog.",
  "model": "text-embedding-3-large",
  "encoding_format": "float",
  "dimensions": 0,
  "task_type": "SEMANTIC_SIMILARITY"
}'

Request body

inputstring | string[]required

Text(s) to embed. Each string must be within the model's max token limit.

modelstringoptional

Embedding model ID.

encoding_formatstringoptional

float returns a number array; base64 returns a base64-encoded Float32Array binary.

dimensionsintegeroptional

Desired output dimensions. Only supported by select models (e.g. text-embedding-3-large, gemini-embedding-001). Must be within the model's supported range.

task_typestringoptional

Task type hint to optimize embeddings for. Only supported by Gemini embedding models.

Response

200application/json
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "embedding": [
        null
      ],
      "index": 0
    }
  ],
  "model": "string",
  "usage": {
    "prompt_tokens": 0,
    "total_tokens": 0
  }
}

Embedding response

objectstring
dataobject[]
objectstring
embeddingnumber[] | string
indexinteger

Index of the input string this embedding corresponds to

modelstring
usageobject
prompt_tokensinteger
total_tokensinteger

Response codes

200

Embedding response

object
400

Unsupported dimensions or task_type

Error
401

Unauthorized

402

Insufficient credits

404

Model not found

Was this page helpful?