How to hit the Fireworks AI API

Fireworks AI at https://api.fireworks.ai/inference/v1 serves open models with an OpenAI-compatible API. Model ids look like accounts/fireworks/models/<name>.

Authentication

Create a key at fireworks.ai. Send it as Authorization: Bearer <key>. In the examples it's written {{FIREWORKS_API_KEY}}.

Full reference: https://docs.fireworks.ai/api-reference/introduction

Chat completion

curl https://api.fireworks.ai/inference/v1/chat/completions \
  -H "Authorization: Bearer {{FIREWORKS_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"model": "accounts/fireworks/models/glm-5p3-flash", "messages": [{"role": "user", "content": "Say hello in Spanish."}]}'
Run in PostTaco