Embeddings Endpoint

Get started with embeddings in minutes by following this step-by-step guide.

Objective: Generate embeddings for the text "encode this" using the model text-embedding-ada-002 via 2 methods:

  1. Konko AI's Python SDK
  2. HTTP

No prior experience with Konko AI? No worries. This tutorial requires no preliminary knowledge and can be completed in less than 5 minutes.


Prerequisite: To follow along, you'll need a Konko API key.

Get one at https://www.konko.ai/.

Method #1: Python SDK

Step #1: Set Up & Install SDK
If you haven't already, first check out the Setup Access & SDK.

Step #2: Initialize & Set API Keys
After obtaining your Konko and OpenAI API keys, initialize them with the following commands:

import konko


Step #3: Generate Embeddings
To get the embeddings for your desired text, use the following commands:

response = konko.Embedding.create(
    input="encode this"

This will return an array of floating point numbers, representing the embedding for the input text. Here's a truncated example of what the output might look like:

  "object": "list",
  "data": [
      "object": "embedding",
      "index": 0,
      "embedding": [
        ... (and so on)
  "model": "text-embedding-ada-002-v2",
  "usage": {
    "prompt_tokens": 2,
    "total_tokens": 2

Method #2: HTTP

You can recreate the above steps in any major programming language. Simply refer to Konko's interactive API Reference docs to understand the HTTP endpoints and how to call them.

What’s Next