The CodeGPT API is a powerful tool for integrating and interacting with AI Agents. It allows you to generate responses based on the input you provide.


To use the API effectively, you need to make API calls to the CodeGPT server, providing the necessary parameters.

This essential parameters include:


The API Key is a unique identifier used to authenticate your requests to the CodeGPT API. It's like a password that lets the API know it's really you making the request.

You can obtain your API Key from the CodeGPT Settings > Access Tokens. After signing up for an account, navigate to your dashboard. Here, you'll find your API Key. Remember to keep it secure and don't share it with others.

Agent ID

The Agent ID is a unique identifier for the AI Agent you've created in the CodeGPT Playground. It's used to specify which AI Agent should process your requests when you interact with the CodeGPT API.

You can find your Agent ID in the Agent > Advance settings of the AI Agent within the CodeGPT Playground.


The message you send to the API is an object that contains two properties: role and content.

  • role can be 'user' or 'assistant'. It indicates who is sending the message.
  • content is the actual text of the message.

{ "role": "user", "content": "Hello, assistant!" }

This structure helps the API understand the context of the conversation and generate appropriate responses.

Core Functions

This function allows you to retrieve information about a specific agent, including its details and capabilities.

List all available agents, making it easy to browse the models at your disposal.

This function enables you to modify and fine-tune the settings of a specific agent.

!pip  install  judini
!python -m pip install python-dotenv
!pip install nest_asyncio

import os
import asyncio
from judini.codegpt.agent import Agent

async def chat_example(prompt):
    # Retrieve the CodeGPT API key and Agent ID

    # Create an instance of the CodeGPT agent using the API key and agent ID
    agent_instance = Agent(api_key=CODEGPT_API_KEY, agent_id=CODEGPT_AGENT_ID)

    # Use an asynchronous loop to interact with the agent and get responses
    async for response in agent_instance.chat_completion(prompt, stream=True):
        print(response)  # Print the responses obtained from the agent