Go quickstart
Fire Mission works with the community go-openai client.
For Anthropic, plain net/http calls work fine — Fire Mission
speaks the wire format directly.
1. Install
go get github.com/sashabaranov/go-openai2. Chat completions
main.go go
package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
)
func main() {
cfg := openai.DefaultConfig("fm_live_...")
cfg.BaseURL = "https://firemission.us/v1"
client := openai.NewClientWithConfig(cfg)
resp, err := client.CreateChatCompletion(context.Background(),
openai.ChatCompletionRequest{
Model: "gpt-4o-mini",
Messages: []openai.ChatCompletionMessage{
{Role: "user", Content: "Hello"},
},
})
if err != nil {
panic(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}3. Streaming
stream.go go
stream, err := client.CreateChatCompletionStream(context.Background(),
openai.ChatCompletionRequest{
Model: "gpt-4o-mini",
Messages: []openai.ChatCompletionMessage{{Role: "user", Content: "Stream me"}},
Stream: true,
})
if err != nil { panic(err) }
defer stream.Close()
for {
chunk, err := stream.Recv()
if errors.Is(err, io.EOF) { break }
if err != nil { panic(err) }
fmt.Print(chunk.Choices[0].Delta.Content)
}4. Anthropic via net/http
anthropic.go go
// Anthropic-compatible call without an SDK — raw net/http works fine.
req, _ := http.NewRequest("POST", "https://firemission.us/v1/messages", bytes.NewBuffer(body))
req.Header.Set("x-api-key", "fm_live_...")
req.Header.Set("anthropic-version", "2023-06-01")
req.Header.Set("content-type", "application/json")
resp, err := http.DefaultClient.Do(req)Notes
- Fire Mission is HTTP/1.1 + HTTP/2 over TLS — no special transport setup needed.
- Use a per-request
context.WithTimeoutfor streaming — the upstream provider's tokens-per-second rate determines the actual call duration. - Errors come back in the OpenAI envelope shape on
/chat/completionsand the Anthropic envelope shape on/messages.