docs
Integrations
cURL Integration

cURL Integration

MakeHub offers full compatibility with the OpenAI API, allowing you to easily use our services via cURL commands for quick testing or custom integrations.

Basic Configuration

To use MakeHub with cURL, you need to specify the MakeHub endpoint and include your API key in the authorization header.

Simple Request Example

curl https://api.makehub.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_MAKEHUB_API_KEY" \
  -d '{
    "model": "meta/llama-3-70b-instruct",
    "messages": [
      {"role": "system", "content": "You are a helpful AI assistant."},
      {"role": "user", "content": "Explain how machine learning works in simple terms."}
    ]
  }'

Using Streaming

To receive responses in streaming mode (as they are generated):

curl https://api.makehub.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_MAKEHUB_API_KEY" \
  -d '{
    "model": "meta/llama-3-70b-instruct",
    "messages": [
      {"role": "system", "content": "You are a helpful AI assistant."},
      {"role": "user", "content": "Write a short poem about artificial intelligence."}
    ],
    "stream": true
  }' --no-buffer

Function Calling

Here's how to perform a function call with cURL:

curl https://api.makehub.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_MAKEHUB_API_KEY" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {"role": "user", "content": "What'\''s the weather like in Paris today?"}
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get the current weather for a given location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and country, e.g. '\''Paris, France'\''"
              }
            },
            "required": ["location"]
          }
        }
      }
    ]
  }'

Get Available Models

To see the list of models available on MakeHub:

curl https://api.makehub.ai/v1/models \
  -H "Authorization: Bearer YOUR_MAKEHUB_API_KEY"