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

# Fireworks

> Use Fireworks for chat, vision, embeddings, and image generation with advanced grammar and JSON modes through Prisma AIRS AI Gateway.

## Quick Start

Get started with Fireworks in under 2 minutes:

<CodeGroup>
  ```sh cURL icon="square-terminal" theme={"system"}
  # 1. Add @fireworks-ai provider in model catalog
  # 2. Use it:

  curl https://aigw.portkey.ai/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $PORTKEY_API_KEY" \
    -d '{
      "model": "@fireworks-ai/accounts/fireworks/models/llama-v3-70b-instruct",
      "messages": [{"role": "user", "content": "Hello!"}]
    }'
  ```

  ```python OpenAI Py icon="python" theme={"system"}
  from openai import OpenAI

  # 1. Install: pip install openai
  # 2. Add @fireworks-ai provider in model catalog
  # 3. Use it:

  client = OpenAI(
      api_key="PORTKEY_API_KEY",  # AI Gateway API key
      base_url="https://aigw.portkey.ai/v1"
  )

  response = client.chat.completions.create(
      model="@fireworks-ai/accounts/fireworks/models/llama-v3-70b-instruct",
      messages=[{"role": "user", "content": "Hello!"}]
  )

  print(response.choices[0].message.content)
  ```

  ```js OpenAI JS icon="square-js" theme={"system"}
  import OpenAI from "openai"

  // 1. Install: npm install openai
  // 2. Add @fireworks-ai provider in model catalog
  // 3. Use it:

  const client = new OpenAI({
      apiKey: "PORTKEY_API_KEY",  // AI Gateway API key
      baseURL: "https://aigw.portkey.ai/v1"
  })

  const response = await client.chat.completions.create({
      model: "@fireworks-ai/accounts/fireworks/models/llama-v3-70b-instruct",
      messages: [{ role: "user", content: "Hello!" }]
  })

  console.log(response.choices[0].message.content)
  ```
</CodeGroup>

## Add Provider in Model Catalog

Before making requests, add Fireworks to your Model Catalog:

1. Go to [**Model Catalog → Add Provider**](https://stratacloudmanager.paloaltonetworks.com/)
2. Select **Fireworks**
3. Enter your [Fireworks API key](https://fireworks.ai/api-keys)
4. Name your provider (e.g., `fireworks-ai`)

<Card title="Complete Setup Guide" icon="book" href="/docs/aigw/product/model-catalog">
  See all setup options and detailed configuration instructions
</Card>

***

## Fireworks Capabilities

### Embeddings

Generate embeddings using Fireworks models:

### Vision Models

Process images with vision models:

### Image Generation

Generate images with Stable Diffusion:

### Function Calling

Use function calling with Fireworks models:

<Card title="Function Calling Guide" icon="function" href="/docs/guides/getting-started/function-calling">
  Explore function calling examples and best practices
</Card>

### Grammar Mode

Fireworks lets you define [formal grammars](https://en.wikipedia.org/wiki/Formal%5Fgrammar) to constrain model outputs. You can use it to force the model to generate valid JSON, speak only in emojis, or anything else. ([Originally created by GGML](https://github.com/ggerganov/llama.cpp/tree/master/grammars))

Grammar mode is set with the `response_format` param. Just pass your grammar definition with `{"type": "grammar", "grammar": grammar_definition}`

Let's say you want to classify patient requests into 3 pre-defined classes:

<Card title="Fireworks Grammar Guide" icon="brackets-curly" href="https://readme.fireworks.ai/docs/structured-output-grammar-based">
  Learn more about grammar mode and examples
</Card>

### JSON Mode

Force JSON output with optional schema validation:

<Card title="Fireworks JSON Mode Guide" icon="brackets-curly" href="https://readme.fireworks.ai/docs/structured-response-formatting">
  Learn more about JSON mode
</Card>

***

## Supported Models

<Card title="Fireworks Models" icon="list" href="https://readme.fireworks.ai/docs/querying-text-models">
  View the complete list of models available on Fireworks
</Card>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Gateway Configs" icon="sliders" href="/docs/aigw/product/ai-gateway">
    Add fallbacks, load balancing, and more
  </Card>

  <Card title="Observability" icon="chart-line" href="/docs/aigw/product/observability">
    Monitor and trace your Fireworks requests
  </Card>

  <Card title="Metadata" icon="tag" href="/docs/aigw/product/observability/metadata">
    Add custom metadata to requests
  </Card>
</CardGroup>


## Related topics

- [Fine-tune](/docs/aigw/integrations/llms/fireworks/fine-tuning.md)
- [Files](/docs/aigw/integrations/llms/fireworks/files.md)
- [Data Service](/docs/aigw/changelog/data-service.md)
- [Nitro Mode (Beta)](/docs/aigw/product/ai-gateway/nitro-mode.md)
