Basic Chat Completion

Send a conversation history and receive an AI-generated response.
curl --request POST \
  --url https://geoff.ai/api/v1/text/chat \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "magma",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    "max_tokens": 1024
  }'

Multi-turn Conversation

Maintain conversation context by passing the full message history:
messages = [
    {"role": "system", "content": "You are a helpful coding assistant."},
    {"role": "user", "content": "Write a Python function to reverse a string."},
]

# First response
response = requests.post(url, headers=headers, json={"model": model, "messages": messages})
assistant_message = response.json()["choices"][0]["message"]

# Continue the conversation
messages.append(assistant_message)
messages.append({"role": "user", "content": "Now make it handle Unicode correctly."})

response = requests.post(url, headers=headers, json={"model": model, "messages": messages})