> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bytez.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Closed source models

> Using chat and chat multi-modal models with closed source providers (OpenAI, Anthropic, etc)

<CodeGroup>
  ```javascript javascript theme={null}
  import Bytez from "bytez.js";

  // insert your key
  const sdk = new Bytez("BYTEZ_KEY");

  // choose your chat model + insert your provider key
  // const model = sdk.model("google/gemini-2.0-flash", "YOUR_GEMINI_KEY");
  const model = sdk.model("openai/gpt-4o", "YOUR_OPEN_AI_KEY");

  // provide the model your chat session
  const messages = [
  { role: "system", content: "You are a friendly chatbot" },
  { role: "assistant", content: "Hello, I'm a friendly bot" },
  { role: "user", content: "Hello bot, what is the capital of England?" },
  ]
  // send to model
  const { error, output, provider } = await model.run(messages);

  // `provider` is the raw OpenAI output
  console.log({ error, output, provider });

  ```

  ```python python theme={null}
  from bytez import Bytez

  # insert your key
  sdk = Bytez("BYTEZ_KEY")

  # choose your chat model
  #
  # model = sdk.model("google/gemini-2.0-flash", "YOUR_GEMINI_KEY")
  model = sdk.model("openai/gpt-4o", "YOUR_OPEN_AI_KEY")

  # provide the model your chat session
  messages = [
    {"role": "system", "content": "You are a friendly chatbot"},
    {"role": "assistant", "content": "Hello, I'm a friendly bot"},
    {"role": "user", "content": "Hello bot, what is the capital of England?"},
  ]
  # send to model
  result = model.run(messages)

  # `provider` is the raw OpenAI output
  print({ "error": result.error, "output": result.output, "provider": result.provider })
  ```

  ```bash http theme={null}
  curl -X POST 'https://api.bytez.com/models/v2/openai/gpt-4o' \
  -H 'Authorization: BYTEZ_KEY' \
  -H 'provider-key: YOUR_OPEN_AI_KEY' \
  -H 'Content-Type: application/json' \
  --data '{
      "messages": [
        { "role": "system", "content": "You are a friendly chatbot" },
        { "role": "assistant", "content": "Hello, Im a friendly bot" },
        { "role": "user", "content": "Hello bot, what is the capital of England?" }
      ]
    }'
  ```
</CodeGroup>
