Make Your First API Call

The Crosshatch API is designed to be compatible with the OpenAI API. This makes it easy for you to use Crosshatch anywhere you use those existing OpenAI APIs, client libraries, or compatible frameworks.

Configuring OpenAI to use Crosshatch

To use Crosshatch where you are already using OpenAI, you will need to change 3 values:

  • Base URL will point to https://api.crosshatch.app/v1

  • API Key will be your API key from the Crosshatch API Keys page.

  • Model will be your preferred Model Mix, discoverable on the Model Mix list page.

import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: "<YOUR-API-KEY>",
  baseURL: "https://api.crosshatch.app/v1"
});

const completion = await client.chat.completions.create({
  messages: [{ role: 'user', content: 'Say this is a test' }],
  model: 'lmsys-overall', // <-- Your Model Mix
});

Last updated