Chat Completions

The primary endpoint for generating AI responses. This endpoint is compatible with the OpenAI Chat Completions API.

Endpoint

POSThttps://api.camelstep.ai/v1/chat/completions

Request Body

Waits for the entire completion to finish before returning. Good for batch processing.

JSON
{
  "model": "google/gemini-3-flash-preview",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Write a haiku about recursion."
    }
  ],
  "temperature": 0.7,
  "max_tokens": 100,
  "stream": false
}

Response

JSON
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "google/gemini-3-flash-preview",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Code calls itself back,\nLayers deep in logic stacks,\nLooping endlessly."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 15,
    "total_tokens": 35
  }
}