> ## 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:

```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)
```

## 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`)

> **[Complete Setup Guide](https://docs.portkey.ai/docs/aigw/product/model-catalog.md)**
>
> See all setup options and detailed configuration instructions

***

## 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:

> **[Function Calling Guide](https://docs.portkey.ai/docs/guides/getting-started/function-calling.md)**
>
> Explore function calling examples and best practices

### 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:

> **[Fireworks Grammar Guide](https://readme.fireworks.ai/docs/structured-output-grammar-based)**
>
> Learn more about grammar mode and examples

### JSON Mode

Force JSON output with optional schema validation:

> **[Fireworks JSON Mode Guide](https://readme.fireworks.ai/docs/structured-response-formatting)**
>
> Learn more about JSON mode

***

## Supported Models

> **[Fireworks Models](https://readme.fireworks.ai/docs/querying-text-models)**
>
> View the complete list of models available on Fireworks

***

## Next Steps

> **[Gateway Configs](https://docs.portkey.ai/docs/aigw/product/ai-gateway.md)**
>
> Add fallbacks, load balancing, and more

> **[Observability](https://docs.portkey.ai/docs/aigw/product/observability.md)**
>
> Monitor and trace your Fireworks requests

> **[Metadata](https://docs.portkey.ai/docs/aigw/product/observability/metadata.md)**
>
> Add custom metadata to requests


## Related topics

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.